I need to validate a textbox based on the validation rule selected by the admin through a dropdown list. ex:
$('<select/>').attr('id', 'SelectOption2_[]' + i)
.attr('name','SelectVal[]')
.append( $('<option/>').text('......To validate choose an option......') )
.append( $('<option/>').text('No validation') )
.append( $('<option/>').text('Validate_as_a_date') )
.append( $('<option/>').text('Validate_as_an_address') )
.append( $('<option/>').text('validate_as_an_e-mail_address') )
.append( $('<option/>').text('Validate_as_numbers_only') )
.append( $('<option/>').text('Validate_as_letters_only ') )
.addClass('selectbx')
.appendTo($div);
These are the options given to the the admin. This select box is referred to a textbox. So for each textbox admin is giving a validation rule where later it will be checked against the value entered by a user.
After giving the validation rule by the admin I store the rule(Ex:Validate as a date, etc ) in the database. So the value which will be entered later by the user will be checked against the validation rule given by the admin.
So to do this, the validation method name should be changed accordingly. Is this scenario possible to do?