NetTalk Central

Author Topic: checkbox dies after validation  (Read 1197 times)

alan

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
checkbox dies after validation
« on: August 17, 2013, 07:24:44 AM »
Hi Bruce,

This seems like a weird one to me.

I have a wizard form.  I want to prevent moving from Tab0 to Tab1 if the user hasn't accepted the license agreement (checkbox - loc:licenseagreed).  The following code works fine to execute the Alert if the user tries to tab without accepting the license agreement:

NextTab  routine
 .......
  case lower(p_web.PageName)
  of lower('NewSubscription_nexttab_' & 0)
    ! Start of "NextTab Tab"
    ! [Priority 4000]

    loc:tabchanging = 1
  ......

ValidateValue::licenseagreed  Routine
  ! Start of "Validate Value"
  ! [Priority 4000]
    if loc:tabchanging = 1 AND loc:LicenseAgreed <> 1
        loc:alert = 'You need to click the checkbox...'
        loc:invalid = 'loc:LicenseAgreed'
  .......

The problem is, after the validation fails, the checkbox is effectively dead.  That is, you can click on it all day long and nothing happens.    Although the checkbox appears to check on and off, it does not generate any events in the web server window so the value is not updated.  From then on, my validation fails.

But, if I move to a different page, or if I click on a different checkbox on that same tab, everything goes back to normal and my validated checkbox starts functioning again. ( on that tab  if I click a button that executes a popup, that does not reset the checkbox - it continues to not function.

This behavior is not affected by selecting or not selecting "Use jQuery button" for the checkbox.

I tried every setting I could find. In the definition for loc:licenseagreed I set cannot be blank or zero.  For the field, I tried setting Immediate validation to Default, Yes and No.  And, for the procedure validation, I set Wizard:Validate Tab on Next to True.

WORKAROUND:  I got around this problem with this which simply prevents the tab change if the checkbox isn't set:

NextTab  routine
  data
! Start of "NextTab routine data section"
! [Priority 5000]

! End of "NextTab routine data section"
  code
  ! Start of "NextTab routine start"
  ! [Priority 5000]

  if p_web.PageName = 'NewSubscription_nexttab_0' AND p_web.GSV('loc:licenseagreed') = 0
    loc:alert = 'You must click the checkbox above indicating you accept the' |
                & ' license agreement before you can continue.'
    exit
  end
Alan Schoolcraft