Re: [PHP] iterate javascript verification

2013-05-27 Thread Tim Dunphy
Hey guys, Thanks for the input! This is pretty nice, and DOES work. I like the fact that the fields have been into an iterative array. It's a very elegant solution. However the problem with this approach is that if you load the page directly it works. But if you call the page from the index.php

Re: [PHP] iterate javascript verification

2013-05-27 Thread Ken Robinson
When you do validation of the form in the same script that shows the form, the normal way to do this is ?php if (isset($_POST['submit'])) { // // validation here // } ? This won't work if you're getting to the page via another form, since the $_POST['submit'] is set. There two ways of

Re: [PHP] iterate javascript verification

2013-05-27 Thread Tim Dunphy
Sounds good! Thanks Ken. Very clear now. Tim Sent from my iPhone On May 27, 2013, at 1:57 PM, Ken Robinson kenrb...@rbnsn.com wrote: When you do validation of the form in the same script that shows the form, the normal way to do this is ?php if (isset($_POST['submit'])) { // //

[PHP] iterate javascript verification

2013-05-24 Thread Tim Dunphy
Hello list, I have a php script that creates a variable number of forms based on a $_POST variable from a preceding page. It then takes the data input into the form and neatly packages the result into an email sent to an email address (eventually to be a ticketing system). Almost everything on

Re: [PHP] iterate javascript verification

2013-05-24 Thread Ken Robinson
You do realize that you shouldn't rely on Javascript to validate values returned in a form? Also, if you use HTML5, you can use the required attribute in the input tag and the browser won't let a user submit a form with a required field not filled. Of course, you should still validate within

Re: [PHP] iterate javascript verification

2013-05-24 Thread musicdev
You can validate via JS if required, for example: (JS CODE): if(element.value.length == 0){ // handle 0 length value } I do agree with Ken that you SHOULD NOT perform JS validation. It is preferable to use php or the new HTML5 features. JS can be turned-off by the user which will make JS

Re: [PHP] iterate javascript verification

2013-05-24 Thread Ken Robinson
I took your code and modified it to use HTML5 validation (and few other changes). You can see the results at http://my-testbed.com/test1/form_validation.phphttp://my-testbed.com/test1/form_validation.php My code follows: ?php $fields =