It appears that the method to handle the params() is never called. Maybe I have
to write some javascript to call this method onLoad and OnChange?
Is there a way of doing this in Rails?
The select is part of a larger page - there is no "submit" button
The other issue is how to get the current provider selection to the select list
- there is a way to do this in options_for_select but I cant for the life of me
get it to work
R
Quoting kuang oon <[EMAIL PROTECTED]>:
> Hi Richard,
> The example previously provided may not be what you want
> because
> it incorporates ajax controls such that when you click OK at the
> selection box, it updates specific fields in the mysql table. the
> find method presupposes that the data is already in the database
> tables. The statements about marshalling /unmarshalling are hence
> misleading :-(. It is mere lookup of a record when you use the find
> method. What you want is still working with params and working with
> another rails metaphor:
> @registration = Registration.new(params[:registration])
>
> With no Ajax, below is the _form.rhtml
>
> <%= error_messages_for 'registration' %>
>
> <!--[form:registration]-->
> <p><label for="registration_cpid">Cpid</label><br/>
> <%= text_field 'registration', 'cpid' %></p>
>
> <p><label for="registration_patientId">Patientid</label><br/>
> <%= text_field 'registration', 'patient_id' %></p>
>
> <p><label for="registration_title">Title</label><br/>
> <%= text_field 'registration', 'title' %></p>
>
> <p><label for="registration_firstname">Firstname</label><br/>
> <%= text_field 'registration', 'firstname' %></p>
>
> <p><label for="registration_surname">Surname</label><br/>
> <%= text_field 'registration', 'surname' %></p>
>
> ....snip....
> <p><label for="registration_email">Email</label><br/>
> <%= text_field 'registration', 'email' %></p>
>
> <p><label for="registration_occupation">Occupation</label><br/>
> <%= text_field 'registration', 'occupation' %></p>
>
> <%= datetime_select 'registration', 'created' %></p>
> <!--[eoform:registration]-->
>
> .when you submit the form using in view page:
> <%= start_form_tag :action => 'create' %>
>
> In controller......
> def create
> @registration = Registration.new(params[:registration])
> ........
> end
> The form data is in params[:registration]
> It is a ruby hash of field names => values
> This you can verify with:
> raise params[:registration].inspect
> Cheers
> kuang
> On 10/01/2007, at 7:55 PM, kuang oon wrote:
>
> > Hi Richard,
> > Try working with params for web form data , not @session .
> > Make sure you have the the view page and models properly set up.
> > You associate a controller action with a page with a rhtml suffix
> > e.g . showafterEdit.rhtml
> > This is in the folder ...views/controller_name/
> > The code segment below is in my file showAfterEdit.rhtml has the
> > following embeded ruby commands...
> > The rhtml file is fed to an erb interpreter, when you see <%= it
> > means that html/javascript stuff is generated for your viewing
> > pleasure in a web browser.
> > The following generates a lot of localities for a drop down list
> > box in your web browser.
> > The trick is to remember that web forms data has to be sent back to
> > the controller via params.
> > The statement below marshalls the data into params
> > <%= link_to 'Generate Cupid Key and clinical template', :action =>
> > 'generateCupid', :id => @registration %>
> >
> > After you pick the right selection in your drop down list, you
> > click on the link , which collects all your form data and sends it
> > back in a convenient hash called params
> > You can the access the form variables by the following statement
> > which unmarshalls the form data: @registration = Registration.find
> > (params[:id])
> > if you puts @registration.location_born you get 'London' etc...
> >
> > I find the following generic statement useful to inspect
> > the .values of params/or any variables, it will create an error
> > page with all the goodies for your inspection,
> > very similar to 'self halt' in smalltalk.
> >
> > raise params.inspect
> >
> > The example:
> > The .rhtml page
> >
> > <% thePlaces = GpsController.new.returnLocations %>
> > <%= in_place_select_editor_field(:registration,
> > :location_born,
> > {},
> > :select_options => thePlaces) %>
> >
> > <%= link_to 'Generate Cupid Key and clinical template', :action =>
> > 'generateCupid', :id => @registration %>
> >
> >
> > Back at the controller....... the .rb page
> >
> >
> > def generateCupid
> > @registration = Registration.find(params[:id])
> > # the above is generic rails idiom...stick to it.
> > end
> >
> > HTH
> >
> > Kuang
> >
> >
> > On 10/01/2007, at 1:11 PM, [EMAIL PROTECTED] wrote:
> >
> >>
> >>
> >>
> >> Anyone still doing work with RubyRails?
> >> I am pegging away at a billing module on the laptop
> >> Struggling with select boxes for *hours* and *hours*.
> >> There seems to be several ways to do this from using HTML tags
> >> directly, to a
> >> rails select function. I populate the options with
> >> options_for_select and I can
> >> render the box but cant seem to get a selection back into a
> >> @session variable
> >> Anyone got any bombproof code?
> >>
> >> Thanks
> >> Richard Hosking
> >> _______________________________________________
> >> Gpcg_talk mailing list
> >> [email protected]
> >> http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk
> >
> > _______________________________________________
> > Gpcg_talk mailing list
> > [email protected]
> > http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk
>
> _______________________________________________
> Gpcg_talk mailing list
> [email protected]
> http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk
>
_______________________________________________
Gpcg_talk mailing list
[email protected]
http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk