RE: dynamic alteration of multiple entry select box content with javascript : empty values upon submission
Subject: RE: dynamic alteration of multiple entry select box content with javascript : empty values upon submission From: Simon Kirk <[EMAIL PROTECTED]> === Ah, you're right - I think I'm missing a vital part of my setup - the function to select the stuff in the right hand boxes! What a foolish schoolboy error. Thanks very much. S Etienne, Ingo (Goetzfried AG) wrote: > You have to select all the options before submit like this: > > > function activateOptions(field){ > for(i=0;i field.options[i].selected=true; > } > } > > > hth > Ingo > > -Original Message- > From: Struts Newsgroup [mailto:[EMAIL PROTECTED]] > Sent: Mittwoch, 27. März 2002 18:25 > To: [EMAIL PROTECTED] > Subject: dynamic alteration of multiple entry select box content with > javascript : empty values upon submission > > > Subject: dynamic alteration of multiple entry select box content with > javascript : empty values upon submission > From: Simon Kirk <[EMAIL PROTECTED]> > === > Hello. > > I have an html page with two select boxes configured to allow multiple > selection in each. The one on the left contains options that are > available, the one on the right contains options that are selected from > those available. I've got a javascript method suite that will transfer > selected options from the box on the left to the box on the right > dynamically. I know it works with normal html form submission as I've used > it many times in the past. Now however I'm trying to get it to work with > struts. > > The first problem I came across was populating the select boxes. Not > normally a problem, but the form bean I had configured to accept the data > from the html page complained about various problems. Finally I got this > nailed. Here's an example of the html: > > > > Available options > > Selected options/td> > > > > >labelProperty="label"/> > > > > onclick="moveSelectedOptions('fooForm','allOptions','selectedOptions')"> > > onclick="moveSelectedOptions('fooForm','selectedOptions','allOptions')"> > > > > > > > > > > (please excuse any shonky indentation :) > > I won't paste the javascript functions up here as they're pretty long > winded. > > The top select box gets its options from a bean containing a collection of > LabelValue beans. The bottom select box gets it options from a collection > contained in the form bean, which is populated from the database with an > Action before the form is rendered. > > Now, if you click one of the two buttons labelled >> or << the options > move across into the relative box as expected. But when I submit the form > I am getting nothing at all in the form bean for either the property > "allOptions" or "selectedOptions". Nothing at all, not a null value, just > nothing. This is independant of the type that you set that field to in the > form bean class you make - struts isn't doing anything clever like turning > the multiple selection into a Vector on the fly for you. > > The selected options should come through as a comma seperated list of IDs. > > > If anybody has any idea where to go I would be very helpful, as reading > through the mailing list archive and checking google hasn't really given > me any useful information. Is there anywhere I can check every value being > gleaned out of the form by the controller servlet? Printing the query > string out in the action class that the html page forwards off to doesn't > help, it's empty too. > > Regards, > Simon > -- Simon Kirk perception|be.developer(java) t. +44 (0) 20 7689 1200 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
RE: dynamic alteration of multiple entry select box content with javascript : empty values upon submission
You have to select all the options before submit like this: function activateOptions(field){ for(i=0;imailto:[EMAIL PROTECTED]] Sent: Mittwoch, 27. März 2002 18:25 To: [EMAIL PROTECTED] Subject: dynamic alteration of multiple entry select box content with javascript : empty values upon submission Subject: dynamic alteration of multiple entry select box content with javascript : empty values upon submission From: Simon Kirk <[EMAIL PROTECTED]> === Hello. I have an html page with two select boxes configured to allow multiple selection in each. The one on the left contains options that are available, the one on the right contains options that are selected from those available. I've got a javascript method suite that will transfer selected options from the box on the left to the box on the right dynamically. I know it works with normal html form submission as I've used it many times in the past. Now however I'm trying to get it to work with struts. The first problem I came across was populating the select boxes. Not normally a problem, but the form bean I had configured to accept the data from the html page complained about various problems. Finally I got this nailed. Here's an example of the html: Available options Selected options/td> (please excuse any shonky indentation :) I won't paste the javascript functions up here as they're pretty long winded. The top select box gets its options from a bean containing a collection of LabelValue beans. The bottom select box gets it options from a collection contained in the form bean, which is populated from the database with an Action before the form is rendered. Now, if you click one of the two buttons labelled >> or << the options move across into the relative box as expected. But when I submit the form I am getting nothing at all in the form bean for either the property "allOptions" or "selectedOptions". Nothing at all, not a null value, just nothing. This is independant of the type that you set that field to in the form bean class you make - struts isn't doing anything clever like turning the multiple selection into a Vector on the fly for you. The selected options should come through as a comma seperated list of IDs. If anybody has any idea where to go I would be very helpful, as reading through the mailing list archive and checking google hasn't really given me any useful information. Is there anywhere I can check every value being gleaned out of the form by the controller servlet? Printing the query string out in the action class that the html page forwards off to doesn't help, it's empty too. Regards, Simon -- Simon Kirk perception|be.developer(java) t. +44 (0) 20 7689 1200 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
dynamic alteration of multiple entry select box content with javascript : empty values upon submission
Subject: dynamic alteration of multiple entry select box content with javascript : empty values upon submission From: Simon Kirk <[EMAIL PROTECTED]> === Hello. I have an html page with two select boxes configured to allow multiple selection in each. The one on the left contains options that are available, the one on the right contains options that are selected from those available. I've got a javascript method suite that will transfer selected options from the box on the left to the box on the right dynamically. I know it works with normal html form submission as I've used it many times in the past. Now however I'm trying to get it to work with struts. The first problem I came across was populating the select boxes. Not normally a problem, but the form bean I had configured to accept the data from the html page complained about various problems. Finally I got this nailed. Here's an example of the html: Available options Selected options/td> (please excuse any shonky indentation :) I won't paste the javascript functions up here as they're pretty long winded. The top select box gets its options from a bean containing a collection of LabelValue beans. The bottom select box gets it options from a collection contained in the form bean, which is populated from the database with an Action before the form is rendered. Now, if you click one of the two buttons labelled >> or << the options move across into the relative box as expected. But when I submit the form I am getting nothing at all in the form bean for either the property "allOptions" or "selectedOptions". Nothing at all, not a null value, just nothing. This is independant of the type that you set that field to in the form bean class you make - struts isn't doing anything clever like turning the multiple selection into a Vector on the fly for you. The selected options should come through as a comma seperated list of IDs. If anybody has any idea where to go I would be very helpful, as reading through the mailing list archive and checking google hasn't really given me any useful information. Is there anywhere I can check every value being gleaned out of the form by the controller servlet? Printing the query string out in the action class that the html page forwards off to doesn't help, it's empty too. Regards, Simon -- Simon Kirk perception|be.developer(java) t. +44 (0) 20 7689 1200 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>