NetTalk Central

Author Topic: Default button on memory form (with no save button) not accepted on Enter keypre  (Read 3052 times)

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Hey Bruce/Folks,

Nettalk 7.28, Clarion 8 (last)

Have got a memory form. The memory form has the save button removed.

There is a custom button on the form, with "Default" ticked.

When I have filled out the fields on the form, on the last field, I'd like to be able to click ENTER and the Default button to be "accepted".

Any chance either I've missed something, making a mistake OR that this could be done?
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
can you make a small example I can play with?

I'm not sure if it's possible - but I'll give it a go.

cheers
Bruce

Larry Sand

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Stu,
If i understand what you're asking, we use this on some jQuery dialogs to handle that:


var enterKeyHandler = function(formId, btnText) {
  $(formId).keypress(function(e) {
     if (e.keyCode == $.ui.keyCode.ENTER) {
        $(":button:contains('"+btnText+"')").trigger("click");
     return false;
      }
    });
};   


Larry Sand

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Thanks Gents.

Bruce .. Will do so if/when I can't work out a different issue which made me not use the Save button instead of a custom button!

Larry .. Nice! Thanks very much, cool beans.
Cheers,

Stu Andrews