Community
Showing results for 
Search instead for 
Do you mean 
Reply

validating controls on a form

Avid Listener
Posts: 44
Country: USA

validating controls on a form

I downloaded a great example from ACT! which dynamically added a tab to either the Contact or Company layout.

 

The example had each control on the edit/add formvalidate with a single function similar to:

 

Private static Control_Validate(…..)

Try

{

If (control.value != null) {

                Control.databind.writevalue;

}

}

Catch….{ }

}

 

In my case I was having a problem with only one tab out of 7 that I had built. Namely the data would not be saved to the underlying entity sub table.

 

The only difference between the one not working and the other 6 was a check box control tied to a Y/N field in the subentity.

 

I decided to isolate the validation of the Check Box control, independently of all other controls. Thus I copied the above, renamed it, and set the Check Box control to use this function for validation.

 

However, when I traced the validation process I was given a warning, not an error, of:

‘this will not be evaluated because check boxes never have a null value but defaults to false….’

 

Thus it never fell into the error routine, showed up in the complile errors or warning, etc. Only at runtime when being executed.

 

In the end, the problem was I was never writing the data to the record in the sub entity as the control.databind.writevalue; was never being fired, and the checkbox (Y/N) field in the underlying subentity was a required field.

 

Since it always true of false, I simple wrote the value every time, but again, a seperate validation function for this type of control.

 

I post this issue, as it took 9 months to resolve, and hopefully others won't spend as much time.

 

 

 

 

 

DBS