I have a remote form, which when submitted calls an action update_file
in my controller. I am not updating anything on the page yet the
update_file call means that it still looks for an update_file template.
I want it to just call the method and return to the current template.
I am then having trouble trying to use javascript after that. My form
tag is as follows:
OK, the only way i can call update_file and remain on the same template
is to use redirect_to the update_file method, however this line is never
executed for some reason?? However, this allows me to remain on the same
template, but the javascript part doesn’t have an effect…
The overall idea is that i have a text area (form), which you can type
into and when the submit button is selected, i would like to call an
update_file method in the controller that will put the contents of the
text field in the database and then maybe have an effect, like the
textfield gets highlighted, to show that it has been saved.
I have a remote form, which when submitted calls an action update_file
in my controller. I am not updating anything on the page yet the
update_file call means that it still looks for an update_file template.
I want it to just call the method and return to the current template.
I am then having trouble trying to use javascript after that. My form
tag is as follows:
OK, the only way i can call update_file and remain on the same template
is to use redirect_to the update_file method, however this line is never
executed for some reason?? However, this allows me to remain on the same
template, but the javascript part doesn’t have an effect…
The overall idea is that i have a text area (form), which you can type
into and when the submit button is selected, i would like to call an
update_file method in the controller that will put the contents of the
text field in the database and then maybe have an effect, like the
textfield gets highlighted, to show that it has been saved.
any ideas?
Don’t use :complete in the form_remote_tag call. Instead, put the
highlight code into an RJS template named update_file.rjs. Something
like (assuming the :id on your form or div tag is “my_form”):
page[:my_form].visual_effect :highlight
c.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.