Create fields with validation from a select field .
Create fields with validation from a select field .
Hi, I'm using a field "select" to display related to the selection of this field fields.
My question is, how to make the selection field "select" discriminate validations other fields.
For example on page
http://alyssaconsultores.com//2/frames2/src/VYR/vyr_persona.php
When selecting the value of field labeled "TIPO DE PERSONA" has two options to choose "Fisica" and "Moral", which displays the fields with the option "show" and "hide".
By selecting the "Fisica" option, I need that fields marked "NOMBRE PRESONA:" and "APELLIDO PATERNO" mandatory.
and selecting the option "Moral" the field labeled "NOMBRE DE R. SOCIAL " is mandatory.
additionally both options "Physical" and "Moral" (STEP2 )has the required fields "SIGLAS RFC", "FECHARFC" AND "HOMOCLAVE" which are validated from the server script.
I made right through valiadciones the server-script (php), but I think I have to do as shown in "Client-side validation."
http://editor.datatables.net/examples/api/clientValidation.html
What I could not perform is the comparison of the select field "physical" and "Moral" and upload the fields validadion options.
I hope you will understand and assume time you can help me. Thank You.
Answers
Hi,
Client-side validation is not enough - you must do server-side validation otherwise your form can be manipulated in ways you don't expect by malicious users.
In order to perform conditional validation at the server-side you need to use anonymous functions. There is documentation on how to use an anonymous function for validation in the manual. That way to can specify whatever logic you require.
Allan