May 23rd, 2011, 3:24 PM
Hey there,
i took the Demo 3 (Something with Flight/Travel Registration) as Template for my own Form.
I rewrote the code using some of the code already present.
This is where i discovered that you are using three types/methods of Validation.
1. Client-Side Validation with JS and rsv.js.
e.g.
2. Server Side Validation with PHP using validate_fields();
e.g.
3. Server Side Validation with PHP filling the Error Array by yourself.
e.g.
Is there an advantage in using two or all three Methods at the same time? Or should i choose only one method?
Is the second Method more reliable because Client-Side is JavaScript?
Is the third for checking more complex conditions like the following?
Thanks in advance for replies, asgaroth
i took the Demo 3 (Something with Flight/Travel Registration) as Template for my own Form.
I rewrote the code using some of the code already present.
This is where i discovered that you are using three types/methods of Validation.
1. Client-Side Validation with JS and rsv.js.
e.g.
Code:
<script type="text/javascript" src="rsv.js"></script>
<script type="text/javascript">
var rules = []
// Attendee / work information
rules.push("required,name,Please fill in your name.");
</script>
2. Server Side Validation with PHP using validate_fields();
e.g.
Code:
$rules = array();
$rules[] = "required,name,Please fill in your name.";
$errors = validate_fields($_POST, $rules);
3. Server Side Validation with PHP filling the Error Array by yourself.
e.g.
Code:
if (isset($_POST) && !empty($_POST))
{
if(!empty($_POST['name']))
$errors[] = "Please fill in your name.";
}
Is there an advantage in using two or all three Methods at the same time? Or should i choose only one method?
Is the second Method more reliable because Client-Side is JavaScript?
Is the third for checking more complex conditions like the following?
Code:
if(!empty($_POST['a']) && empty($_POST['b']))
$errors[] = "Please fill in B when providing A.";
Thanks in advance for replies, asgaroth