On Sat, Jan 14, 2012 at 4:11 AM, Joachim Cheng wrote:
Yeah, I can do it.
<%= link_to "save", "#", :remote=>true, :onclick=>"save_with_click"%>
function save_with_click(){
$("#form_id").submit();
}
change to:
<%= form_tag save_file_path, :id => 'mysubmitform' do %>
...
<a href="javascript:save();">save</a>
<script>
function save(){
$('#mysubmitform').submit();
return false;
}
</script>
...
<% end %>
This function can works for me!! I am using jquery colorbox.
Thank you, Javier.
Yeah, I can do it.
<%= link_to "save", "#", :remote=>true, :onclick=>"save_with_click"%>
function save_with_click(){
$("#form_id").submit();
}
change to:
<%= form_tag save_file_path, :id => 'mysubmitform' do %>
...
<a href="javascript:save();">save</a>
<script>
function save(){
$('#mysubmitform').submit();
return false;
}
</script>
...
<% end %>
This function can works for me!! I am using jquery colorbox.
Thank you, Javier.
I tought you jus wanted to save it via AJAX that's why I use that remote
true, you can do that <a> label using rails. Also that :id=>"mysubmitform"
may not be needed, just check the id of the form using a debugger (firebug
in firefox or the one that comes in chrome).
Javier
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.