Validation controls

minn

Active member
Joined
Apr 10, 2006
Messages
37
Programming Experience
Beginner
Hello,

I have a web-form that acts as a data-entry form to insert a new record into an access database. The form uses required field validators to make sure something is entered or selected into the controls (textboxs and dropdownlists).

The problem is it is conflicting with my current reset button that clears everythin entered into the controls and sets these as "".

Is there another way of refreshing or reloading forms to avoid this problem???
 
The code for my reset button click event is as follows:

VB.NET:
[SIZE=2]txtApplication.Text = "" [/SIZE][SIZE=2][COLOR=#008000]' sets application textbox to blank
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]
[/COLOR][/SIZE][SIZE=2]ddlVendors.SelectedItem.Value = 0 [/SIZE][SIZE=2][COLOR=#008000]' sets ddlvendors to item; 'select one'
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]
[/COLOR][/SIZE][SIZE=2]ddlsoftwaretype.SelectedItem.Value = 0 [/SIZE][SIZE=2][COLOR=#008000]' sets ddlsoftwaretypr to item 'select one[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#008000]
[/COLOR][/SIZE][SIZE=2]txtNoofcopies.Text = "" [/SIZE][SIZE=2][COLOR=#008000]' sets noofcopies textbox to blank
[/COLOR][/SIZE][SIZE=2]txtproductkey.Text = "" [/SIZE][SIZE=2][COLOR=#008000]' sets the prodcut key textbox to blank
[/COLOR][/SIZE][SIZE=2]txtcomments.Text = "" [/SIZE][SIZE=2][COLOR=#008000]' sets the comments textbox to blank
[/COLOR][/SIZE][SIZE=2]lblconfirm.Text = "" [/SIZE][SIZE=2][COLOR=#008000]'Clear the confirmation label[/COLOR][/SIZE]

validation controls are set on txtapplication, ddlvendors, ddlsoftwaretype.
The validation control for txtapplication is requiredfieldvalidator and the ddls have comparevalidators that determine that the first item in the ddls (select one) is not set when the form is submitted.

Now i can see how things would conflict since one one hand the controls require information and on the other hand when clicking the reset button you are clearing information.

Can you suggest another way of doing this?
 
Comment it

As Mr Kulrom told reset should not conflict with the validation controls. Purpose of resetting is to clear everything and enter them all ove again. In spite of this if you want validation control textboxes not to be cleared you just remove txtapplication.text="" or comment it. And do the same with the other controls. If what you want is different from what I have understood just elaborate the problem.
 
Thanks for the ideas guys,

I have resolved the problem. To do so, in my reset click procedure i put for instance:

txtapplication.text = ""
validapp.IsValid = true

This causes the textbox to clear and also passes the validation without causing a conflict.
 
Back
Top