Hey all, I currently have a form with a select menu that is populated via AJAX. Problem is it seems that the select menu is not being sent with the form. Is this correct? Does any one know of a work around? Thanks Iggy
If it''s not being sent with the form, the problem is likely one of the following: 1. To be submitted, elements must have a name and a value. 2. Elements must not be disabled. 3. Nothing is selected, or the selected option has no value. See http://www.w3.org/TR/REC-html40/interact/forms.html#successful- controls TAG On Jul 4, 2006, at 9:57 PM, iggy-WbLwnTuLOdP0CCvOHzKKcA@public.gmane.org wrote:> > Hey all, > > I currently have a form with a select menu that is populated via > AJAX. Problem is it seems that the select menu is not being sent > with the form. Is this correct? Does any one know of a work around? > > Thanks > Iggy > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Tom Gregory wrote:> 3. Nothing is selected, or the selected option has no value.A selected option is allowed to have an empty string as a value, just like text inputs, etc. But prototype doesn''t quite work that way. The following is perfectly legal in HTML. <select name="foo"> <option value="">-- Please Select --</option> <option>1</option> <option>2</option> </select> But if the first <option> is selected, Form.Serialize will send "-- Please Select --" as the value instead of "". -- Michael Peters Developer Plus Three, LP
I fixed the problem. I was creating the whole <select> using innerHTML. Instead of that I used js to populate the select using JSON retrieved via AJAX and that worked fine. Iggy On Wed, 05 Jul 2006 12:11:08 -0400, Michael Peters <mpeters-aUYv5hkjw45l57MIdRCFDg@public.gmane.org> wrote:> > > Tom Gregory wrote: > >> 3. Nothing is selected, or the selected option has no value. > > A selected option is allowed to have an empty string as a value, just like > text > inputs, etc. But prototype doesn''t quite work that way. The following is > perfectly legal in HTML. > > <select name="foo"> > <option value="">-- Please Select --</option> > <option>1</option> > <option>2</option> > </select> > > But if the first <option> is selected, Form.Serialize will send "-- Please > Select --" as the value instead of "". > > -- > Michael Peters > Developer > Plus Three, LP > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs