Board index » delphi » Validate Form

Validate Form


2007-06-26 09:33:53 PM
delphi6
I am trying to learn how to validate my form.
I see the DoSubmitValidation property of the button.
I see the OnSubmit event of the edit boxes.
How do these work together?
How do I stop the submittal of the form if it doesn't validate?
Thanks,
Marion
 
 

Re:Validate Form

If you have a button with dosubmitvalidation = true then if you have another
control that has required = true then it must be filled in before the submit
will be allowed. I am not sure how the onsubmit event ties into the above.
"Marion Smith" <XXXX@XXXXX.COM>writes
Quote
I am trying to learn how to validate my form.

I see the DoSubmitValidation property of the button.
I see the OnSubmit event of the edit boxes.

How do these work together?
How do I stop the submittal of the form if it doesn't validate?

Thanks,
Marion


 

Re:Validate Form

So, based on your comments, I think I will go back to what I was doing. I
will dumb using buttons with Style := btSubmit and just use them as
Style:=btButton. Then I can validate, then decide whither to forward the
data on to the database.
Thank you.
"Joel" <XXXX@XXXXX.COM>writes
Quote
If you have a button with dosubmitvalidation = true then if you have
another control that has required = true then it must be filled in before
the submit will be allowed. I am not sure how the onsubmit event ties
into the above.

"Marion Smith" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>I am trying to learn how to validate my form.
>
>I see the DoSubmitValidation property of the button.
>I see the OnSubmit event of the edit boxes.
>
>How do these work together?
>How do I stop the submittal of the form if it doesn't validate?
>
>Thanks,
>Marion
>
>


 

Re:Validate Form

Hi
you need to have a boolean variable which starts as true. In the
Onvalidate method, you check each of the fields which you want to check for
valid values. If any one of the fields is incorrect, you set the boolean
variable to false. If the boolean variable is false at the end of the
OnValidate method, it will not allow ne to continue. I typically have
various labels on my forms which are not visible. During the OnValidate
method processing, I set whichever apply to visible so that the user knows
where the problem is.
Hope this makes sense, otherwise contact me off group and I can send you an
example.
Bruce
"Marion Smith" <XXXX@XXXXX.COM>writes
Quote
I am trying to learn how to validate my form.

I see the DoSubmitValidation property of the button.
I see the OnSubmit event of the edit boxes.

How do these work together?
How do I stop the submittal of the form if it doesn't validate?

Thanks,
Marion


 

Re:Validate Form

Thank you Bruce for the help. I started doing something similar to what you
are doing. I put the hidden labels on the form and test the fields and turn
on the label if there is an error. I found that I had to change the button
from Style := bsSubmit to Style := bsButton to stop the form from
submitting.
"Bruce Eglington" <XXXX@XXXXX.COM>writes
Quote
Hi
you need to have a boolean variable which starts as true. In the
Onvalidate method, you check each of the fields which you want to check
for valid values. If any one of the fields is incorrect, you set the
boolean variable to false. If the boolean variable is false at the end of
the OnValidate method, it will not allow ne to continue. I typically have
various labels on my forms which are not visible. During the OnValidate
method processing, I set whichever apply to visible so that the user knows
where the problem is.

Hope this makes sense, otherwise contact me off group and I can send you
an example.

Bruce

"Marion Smith" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>I am trying to learn how to validate my form.
>
>I see the DoSubmitValidation property of the button.
>I see the OnSubmit event of the edit boxes.
>
>How do these work together?
>How do I stop the submittal of the form if it doesn't validate?
>
>Thanks,
>Marion
>
>