NetTalk Central

Author Topic: Selecting tab to return to on error  (Read 3654 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Selecting tab to return to on error
« on: August 22, 2011, 06:20:30 AM »
Hi,

When the save button is pressed on a webform and an error is detected, I need to return to the tab on which the error occurs. I can only do this from the last tab - so the field validation won't help. How can I return the user to the wanted tab from the ValidateUpdate routine i.e. after the ValidateRecord routine is called?

Thys

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Selecting tab to return to on error
« Reply #1 on: August 26, 2011, 04:31:26 AM »
...or perhaps I should do the form validation on a field on tab 1 so that the error comes from there and the form is automatically set back to tab 1?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Selecting tab to return to on error
« Reply #2 on: August 26, 2011, 11:32:26 PM »
do you have "validation on next" for the wizard on or off?

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Selecting tab to return to on error
« Reply #3 on: August 29, 2011, 06:17:50 AM »
Yes it's on. Otherwise it would go right to the end before the errors are picked up when pressing save.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Selecting tab to return to on error
« Reply #4 on: August 29, 2011, 11:46:53 PM »
Hi Thys,

I've tweaked the Example 57 (Tabs) to show what I _think_ is what you're doing. (This will be in the 5.34 build).
However, as I understand it,

you are doing some custom validation in the ValidateRecord routine -
ie you're doing this when the user clicks on "Save" (or Finish).

The code I added (to the end of the ValidateRecord routine) goes something like this;

   ! for some reason I only want to check this checkbox here, not earlier.
Code: [Select]
 

  If loc:field2b = 0
    loc:Invalid = 'loc:field2b'
    loc:field2b:IsInvalid = true
    loc:alert = 'Tick that you support the Stormers'
    loc:InvalidTab = 1 ! tabs are numbered from 0
  End


Note the addition of the loc:InvalidTab value, tabs are numbered from 0, so in this case I want to go back to the second tab (ie tab number 1).

HTH

cheers
Bruce