louis w
unread,Jul 14, 2008, 3:49:51 PM7/14/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Spinoffs
I am using JS to replace my submit buttons with A tags w/ observers.
The reason for this is I want better looking buttons. When the A is
clicked it does some validation, and then "clicks" the hidden submit
button.
When JS "clicks" the button however they name/value is not getting
submitted along with the other form values in the _POST such as if a
person clicked a regular submit button. Do you know how to get this
to happen?
As an FYI, here is the code I am using:
$(form).select('INPUT[type="submit"]').each(function(b) {
new_id = 'submit_btn_'+i;
// Turning off hide so you can test the difference
// input_button = b.hide();
input_button = b;
input_button.insert({after: '<a class="button_dark submit"
id="'+new_id+'" href="#" onClick="this.blur();"><span>'+
input_button.value +'</span></a>'});
new_button = $(new_id);
// Can't use click, because sometimes mouseup/down does not happen on
the same element, there is a span in there too.
new_button.observe('mouseup', function(e) {
e.stop();
// Do some validation
if (true) input_button.click();
});
i++;
});