RJS and Rails

Ok this is the code I have in my view:

<select id="client_gender" name="client[gender]" onChange="<%= remote_function( :url => {:action => 'change'}) %>">         <option value="">- Select -</option>         <option value="Male">Male</option>         <option value="Female">Female</option> </select>

You have nothing in your remote_function to pass the selected value to the action. You're using Firebug, so turn on "ShowXMLHttpRequests" so you can see the exact request being sent to the server. You'll see that "Male" or "Female" are not being sent.

You should:

   1) Wrap the whole thing in a remote_form_for() call.    2) Use observe_field() to submit the form on the 'change' event for 'client_gender'

now in my change.rjs, I have:

if @client_gender.value = 'Male'

This is always true, because you're assigning 'Male' to the variable. You want == for an equality test. At that point, it will always be false until you fix the problem above.