Jump to content

Passing Listboxes As Parameters To A Function


JORGEMAL
 Share

Recommended Posts

I have a web form with 3 pairs of listboxes, 6 listboxes total. I perform exactly the same actions in a pair by pair basis so I would like to use the same function code for the 3 pairs passing 2 listboxes as parameters depending on which pair will be used. Is it possible to indicate a function that a parameter is a listbox?Please advice.Best regards,Jorge Maldonado

Link to comment
Share on other sites

The real question for me is HOW do you want to call them? It might make a difference if you call them from an change event or from a button. The concept is simple, but the actual syntax will change. Could you describe the situation a little more? Specifically, what event/element will call this function?

Link to comment
Share on other sites

The real question for me is HOW do you want to call them? It might make a difference if you call them from an change event or from a button. The concept is simple, but the actual syntax will change. Could you describe the situation a little more? Specifically, what event/element will call this function?
The function shoudl be called from a button's click event. I am passing items from one listbox to the other so when I click a button then I add the selected item in the first listbox to the second listbox.Regards,Jorge Maldonado
Link to comment
Share on other sites

It would probably make the most sense to have a function that accepts the IDs of the two boxes, where it can look up the selected record in the first one and add it to the second one. So all the function would need are the IDs of the two boxes, and you would use document.getElementById to access each select element and figure out which record is selected.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...