List Info

Thread: Bug: Multiple Submit Buttons w/ form_remote_tag




Bug: Multiple Submit Buttons w/ form_remote_tag
user name
2006-11-02 14:23:38
Hi,

If you have only got 2 buttons then you can take advantage
of the fact 
that disabling a button means that it won't get posted. In
the code 
below, when the user presses 'Save', the save_button gets
disabled and 
the controller sees the presence of preview_button. If
'Preview' gets 
pressed then the first button ('save_button') gets seen as
described in 
the earlier posts. It's ugly and the controller logic looks
upside down, 
but it seems to work for me...

 <%= submit_tag "Save", :name =>
'save_button', :disable_with => "..." 
%>
 <%= submit_tag "Preview", :name =>
'preview_button' %>

Controller:

  def save
    # Save button gets disabled when pressed, so no save
button means 
preview...
    if !params['save_button'].nil? then
      do_preview
    else
      do_save
    end
  end

derek.haynes wrote:
> I've run across a problem when attempting to submit a
form with the
> form_remote_tag when the form contains multiple submit
buttons.
> 
> My form contains 2 submit buttons, a
"Preview" button and a "Post
> Message" button:
> <%= submit_tag 'Preview' %>
> <%= submit_tag 'Post Message' %>
> 
> When the form is submitted, the value of params['commit'] is the
> value of the first submit tag ('Preview' in this case)
no matter what
> button is used to submit the form.
> 
> This is not present when changing the form to a
standard non-ajax form.
> 
> Any one else run across this problem or have a
suggested fix?
> 
> 
> --
> Derek Haynes
> HighGroove Studios - http://www.highgroove.com
> Atlanta, GA
> Keeping it Simple.
> 404.593.4879


-- 
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---

Hebrew file names in windows
user name
2006-11-03 18:50:34
Hi!

I download a site with Hebrew filenames. The files on the
disk have funny names with strange symbols. I think it's
UTF-8 problem. You can reproduce it, use the following URL:
http://vir
tual2002.tau.ac.il/users/www/8725/%D7%96%D7%9B%D7%95%D7%99%D
7%95%D7%AA%20%D7%90%D7%93%D7%9D%20%D7%91%D7%96%D7%9E%D7%9F%2
0%D7%97%D7%99%D7%A8%D7%95%D7%9D/ , (and filter out the
directory above, http://v
irtual2002.tau.ac.il/users/www/8725/ . After download
finishes, compare the link names and the file names.


Regards,
Roman.


-- 
HTTrack Website Copier mailing-list
Please post replies to: http://forum.httrack.com
Unsubscribe: mailto:ml_requesthttrack.com?subject=unsubscribe
Troubles: mailto:postmasterhttrack.com

	
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )