I have a web form with two text fields each with its own submit field. I cannot place them in separate forms on the same page and I want to use a RequiredFieldValidator control on them. The problem is that whichever I click the other control complains that the field has not been filled in. How is best to get round this problem?
Because the ASP.NET 1.x does not support grouping validators, so when you click the button all the validators in the web page will be running. In this case, you might consider implementing your own custom validator.
There are a couple of options here that you might consider:
+ You are still able to use the ASP.NET validators, but depending on which button is clicked you need to disable the validator accordingly (set the enabled property to false. The validators in the web page are basically stored in the Page_Validators array at the client side.
+ You provide your own client side functions like you did in the classic ASP.
+ You can implement your own custom validator that basically only runs when a specific button is clicked. You can do a simple checking in the client side validation function.
+ You can use the ASP.NET validators and store them in the seperate arrays, depending on which button is clicked you can get the validators from an array to run.
Last Visit: 31-Dec-99 18:00 Last Update: 28-Apr-17 0:41