NetTalk Central

Author Topic: Checkbox and Radio Button validation  (Read 1945 times)

rupertvz

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
    • Email
Checkbox and Radio Button validation
« on: August 22, 2011, 01:14:14 PM »
Hi Guys,

On a NetWebForm, form-style:  Wizard ..
What will be the best way to validate a selection of a Checkbox or Radio Button?

For example:  The user should not be able to click NEXT, when the checkbox is off ...

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Checkbox and Radio Button validation
« Reply #1 on: August 22, 2011, 09:59:11 PM »
you can't disable the Next button, but you can do validation on the Next, and complain to the user (displaying an appropriate message, and remaining on the tab).

On the "Validation" tab for the Form Settings turn on the option;
Wizard: Validate tab on Next.

Then put some validation on the field.

cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
    • Email
Re: Checkbox and Radio Button validation
« Reply #2 on: August 23, 2011, 12:48:45 AM »
Hi Bruce,

>> On the "Validation" tab for the Form Settings turn on the option;
>> Wizard: Validate tab on Next.
I have done this

>> Then put some validation on the field.
The checkbox field and radio buttons does not have a validation tab-option ..
The only option is "immediate validation = default"

How do I put some validation on a checkbox field or radio buttons?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Checkbox and Radio Button validation
« Reply #3 on: August 23, 2011, 06:34:21 AM »
Check-boxes and Radios don't typically need "validation" because usually they only present the user with valid values, and default to one of those values.

In the case of "tick this box to acknowledge that we own you completely from here on" type setting - I'll add a validation to checkbox fields to more easily cope with this sort of box.

But you can add any validation you like, to any field you like;

Right click on a procedure and choose "Source".
Search for the routine
ValidateValue::FieldName

in that routine do any validation you like (of course using SessionValues where appropriate). If you feel the value is not valid then set;

    loc:Invalid = 'FieldName'
    FieldName:IsInvalid = true
    loc:alert = 'whatever message you want'

cheers
Bruce