NetTalk Central

Author Topic: Force Save/Login Button Click on Wizard 'Next'  (Read 5028 times)

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Force Save/Login Button Click on Wizard 'Next'
« on: August 13, 2015, 01:26:26 PM »
Hi Bruce,

I'm trying to force the 'Save/Login' button to be clicked if the user only has access to one site but the button is not behaving as expected.

Attached is the test app. Login with username and password 'test' and click the 'Next' button. In debugview you should see 'clicking save button to force login'. In the firebug console you should see 'save clicked' which means the click event should have happened, but the form validation does not happen and the user is directed to the next tab with the 'Site' drop.

Regards,
Trent

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Force Save/Login Button Click on Wizard 'Next'
« Reply #1 on: August 17, 2015, 12:41:13 AM »
Hi Trent,

your code is ok, but the Save button is disabled on the first tab, so the click is swallowed by the button. (clicking on disabled buttons does nothing by design.)

Fortunately there is a JavaScript method to enable the button (and a JavaScript method to do the save) so change

p_web.Script('$("button[name=''save_btn'']").click();')

to

  p_web.ntForm(loc:formname,'enableSave')
  p_web.ntForm(loc:formname,'clickSave')


Cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Force Save/Login Button Click on Wizard 'Next'
« Reply #2 on: August 17, 2015, 01:57:25 AM »
Hi Bruce,

Good stuff! Is there also a method to disable the 'next' button or methods for hiding the 'next' and 'previous' buttons altogether?

Where can I find info on these methods and what else is there?

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Force Save/Login Button Click on Wizard 'Next'
« Reply #3 on: August 17, 2015, 07:18:15 AM »
Hi Trent,

>> Good stuff! Is there also a method to disable the 'next' button or methods for hiding the 'next' and 'previous' buttons altogether?

So the wizard interface is a JavaScript widget called ntwiz and the code for it is in jquery.nt-wiz.js.
there currently aren't methods in the widget to hide and unhide the next & prev buttons - but that could be added if necessary. However you can hide them there with;

p_web.script('$(''[name="wizprevious_btn"]'').hide();')
and
p_web.script('$(''[name="wiznext_btn"]'').hide();')


>> Where can I find info on these methods and what else is there?

the save button is part of the form, and you'll find the methods in jquery.nt-form.js

At the moment these JavaScript widgets are undocumented other than the code itself.

cheers
Bruce





trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Force Save/Login Button Click on Wizard 'Next'
« Reply #4 on: August 17, 2015, 03:06:19 PM »
Hi Bruce,

Thank you. One thing I have noticed:

1) Changing the properties of the 'Next' button does not work:
    p_web.site.NextButton.TextValue = 'Log On'
    p_web.site.NextButton.ToolTip = 'Click here to Log On'
    p_web.site.NextButton.MobileText = 'Log On'

Haven't tested the 'previous' button.

Regards.
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Force Save/Login Button Click on Wizard 'Next'
« Reply #5 on: August 17, 2015, 10:14:04 PM »
hi Trent,

NextButton and PreviousButton are for browses. You want WizNextButton and WizPreviousButton for the wizard.

Cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Force Save/Login Button Click on Wizard 'Next'
« Reply #6 on: August 18, 2015, 04:09:08 AM »
Oops! Thank you.