Hi,
I have a page with entryfields, comboboxes etc and some buttons. One button is the "Save" button.
I want that, if the user presses "return" somewhere at the page, the save Button is "pressed"/submitted.
How can I set the default button which is submitted when pressing the enter button?
Sabine
-- View this message in context: http://forum.world.st/How-to-define-default-Button-tp4700070.html Sent from the Seaside General mailing list archive at Nabble.com.
Sabine,
in HTML, teh first submit Button is the one that gets activated when you press enter. No Exceptions to that rule (other than a so called fix to still render it first but reposition it using css...).
In Seaside, however, you can define a defaultCallback for a form. Maybe that is something to look into. There is a nice (but maybe dated) post by kentreis: http://kentreis.wordpress.com/2007/09/08/one-field-forms-and-ie-quirks/
HTH
Joachim
Am 22.07.13 16:32, schrieb Sabine Knöfel:
Hi,
I have a page with entryfields, comboboxes etc and some buttons. One button is the "Save" button.
I want that, if the user presses "return" somewhere at the page, the save Button is "pressed"/submitted.
How can I set the default button which is submitted when pressing the enter button?
Sabine
-- View this message in context: http://forum.world.st/How-to-define-default-Button-tp4700070.html Sent from the Seaside General mailing list archive at Nabble.com. _______________________________________________ seaside mailing list seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Hi Sabine,
Is it an option to define the 'save' button as the submit button and the rest as simple buttons? This is done by setting the type of the button.
See here: http://stackoverflow.com/questions/290215/difference-between-input-type-butt...
Johan
On 22 Jul 2013, at 16:32, Sabine Knöfel sabine.knoefel@gmail.com wrote:
Hi,
I have a page with entryfields, comboboxes etc and some buttons. One button is the "Save" button.
I want that, if the user presses "return" somewhere at the page, the save Button is "pressed"/submitted.
How can I set the default button which is submitted when pressing the enter button?
Sabine
-- View this message in context: http://forum.world.st/How-to-define-default-Button-tp4700070.html Sent from the Seaside General mailing list archive at Nabble.com. _______________________________________________ seaside mailing list seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Hi Joachim and Johan,
I dont want to submit the page and I have n forms and buttons in various orders...
after googling for a while I found
html document addLoadScript: 'jQuery(document).keypress(function(e) { if (e.which == "13") { jQuery("#saveButton").click(); return false; } });'
as a working solution. Now I only have to define #saveButton on each of my pages and thats all.
Sabine
-- View this message in context: http://forum.world.st/How-to-define-default-Button-tp4700070p4700203.html Sent from the Seaside General mailing list archive at Nabble.com.
and before triggering the save button, trigger change event of the element which has current focus. otherwise last entry will be lost
html document addLoadScript: 'jQuery(document).keypress(function(e) { if (e.which == "13") { jQuery("*:focus").trigger(''change''); jQuery("#saveButton").click(); return false; } });'
-- View this message in context: http://forum.world.st/How-to-define-default-Button-tp4700070p4700211.html Sent from the Seaside General mailing list archive at Nabble.com.
seaside@lists.squeakfoundation.org