Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CreateUserWizard Javascript

I am using the CreateUserWizard asp control to create users however it is a customer implementation that has extra entry controls such as forename, surname and so on.

Using javascript I am changing the text fields etc that are available to the users my problem is the validation of these controls. I want to try and prevent server request when the user tries to create the user if the fields are not populated for example.

I have tried to add a javascript function that would check the validity of all the controls created via javascript to the oncreatinguser, onFinishButtonClick onNextButtonClick event with no avail.

My thoughts now is to create the via javascript if that can be done, but am sure there are better methods of doing this.

Does anybody have any suggestions?

Thanks for any responses.

like image 961
RJF Avatar asked May 21 '26 12:05

RJF


1 Answers

You can try using the built-in ASP.NET Validator controls. These should do both client and server side validation for you.

<asp:RequiredFieldValidator ControlToValidate="txtForename" ErrorMessage="Please enter a forename." runat="server" />

You should not necessarily be adding extra fields via Javascript. For the CreateUserWizard control, implement a custom template with the controls you need so they'll be easier to work with on postback.

like image 123
kamranicus Avatar answered May 24 '26 02:05

kamranicus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!