Javier Quarite wrote in post #1040531:
On Thu, Jan 12, 2012 at 12:04 PM, Joachim Cheng
wrote:
Yes, a page has many form to fill. when you click [x] close button, it
appear the dialog as above. When I try to click 'save' button, it won't
works..

--
Well then, the easiest way of doing that is:

* inside the function that grabs the "save" action

$("#form_id").submit();

I'm not really sure the way colorbox works, what I gave works for
example:

<%= link_to "save", "#", :remote=>true, :onclick=>"save_with_click"%>

function save_with_click(){
$("#form_id").submit();
}

I think you can do the same with your submit button

Javier
Ok, I give you the simple code.. Hope you can teach me.. Thank you.
Where should I place "form_id"??

<%= form_tag action_tasks_path do %>
<table border="1">
<tr>
<td colspan="3" align="right">
<a class='inline' href="#inline_content">[X]</a>
<div style='display:none'>
<div id='inline_content'>
<b>Do you want to save changes made to this job?</b><br/>
All details will be lost if you don't save them.
<br/><br/>
<%= link_to "Don't Save", main_home_path %> |
<a href="javascript:parent.$.colorbox.close()">close</a>
<%= link_to "save", "#", :remote => true, :onclick =>
"save_with_click"%>
</div>
</div>
</td>
</tr>
<script>
$(document).ready(function(){
$(".inline").colorbox({inline:true, width:"500"});
});
function save_with_click(){
$("#form_id").submit();
}
</script>
</table>

name: <%= text_field_tag :name, params[:name] %>
Description:
<%= text_area_tag :description, params[:description], :rows => 3 %>
<% end %>

--
Posted via http://www.ruby-forum.com/.

--
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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 9 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 12, '12 at 5:23a
activeJan 14, '12 at 11:31a
posts9
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Joachim Cheng: 5 posts Javier Quarite: 4 posts

People

Translate

site design / logo © 2022 Grokbase