[Rails] Post problem with select lists
Thibaut Barrère
thibaut.barrere at gmail.com
Thu Dec 29 10:28:05 GMT 2005
Hi Nick
I'd use the script\breakpointer to check what's happening here (put a
breakpoint instruction just above the line you want to check, and launch the
breakpointer: you'll be able to quickly inspect the variables and know
exactly what happens).
Thibaut
On 29/12/05, Brutyn Nick <brutyn_nick at hotmail.com> wrote:
>
> hey,
>
> i have this problem
>
> how come i always get -1 for the select list??
>
> rhtml
>
> First, select a client.
> <select id="client_id" name="client[id]" onChange="submit();" >
> <%= options_for_select(@client_options, @client_id.to_i) %>
> </select><%= @client_id %>
>
>
> controller
> if @request.post?
> if @request.xml_http_request? #called by ajax,
> @client_id = -2
> else
> @client_id = -11#params[:client][:id].nil? ? -11 :
> params[:client][:id]
> end
> else
> @client_id = -1
> end
>
> shouldnt it be-11 ???
>
>
> Output
> First, select a client.
> <select id="client_id" name="client[id]" onChange="submit();" >
> <option value="-3">Select a client</option>
> <option value="3">Twodecode</option>
> </select>-1
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20051229/a1965ba8/attachment.html
More information about the Rails
mailing list