|
Posted by Rik on 08/16/06 22:40
Chris wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:6LWdnftQxpp1xn_ZnZ2dnUVZ_umdnZ2d@comcast.com...
>>
>> Chris,
>> I don't rely on js for form validation. The user can turn it off too
>> easily. I validate everything server side. Even when I validate
>> with JS, I revalidate on the server.
>>
> <snip>
>> I use both, depending on the circumstances.
>>
>> But the bottom line is - always validate server side, even if you
>> fist validate client side.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstucklex@attglobal.net
>> ==================
>
> Hi,
>
> I've been working with an example (from
> http://www.php-mysql-tutorial.com/form-validation-with-php.php) that
> validates first js, then PHP. It used an onClick event in the submit
> button rather than an onSubmit in the form tag. The copy/paste code
> from the site works beautifully, first the js, then the php. The
> original form doesn't define an action, but I inserted one just to
> see what would happen and it still worked. I took the code, pasted it
> into my form page and edited the variables to match only 2 of my
> textboxes (simply to check if they had a value) for a test run. In
> the test I removed the action parameter just to see if the validation
> worked. I left both textboxes empty - the form ran but the only
> validation that occurred was PHP, the js alerts never appeared. Then
> I put the form action pointing to a processing page back in, it never
> saw the js, posted the php errors, then processed through. I tried
> useing onSubmit, but it doesn't work at all. It looks like I'm
> stuck with only having server-side processing, which refreshes the
> page each time the error message comes up - so I need to add the
> $_POST values or variables back into the form.
>
> Since beginning to write this message, I have edited the page several
> times, and what you see below works with php validation, but the js
> never occurs. I just don't understand why it works so well in the
> example (even when I make changes or change the action parameter,
> etc.) I've snipped several areas in what you see below, but compared
> to the original code at the website, the js appears to be correct
> other than editing variables (unless I accidentally overlooked
> something like a parens or whatever). I'm just burnt out now....and
> have 1 day to finish and deploy the site.
Dude, it's this simple:
- if the js validation doesn't occur/is faulty, look at the outputted html
source/js. If you don't find the problem, post in comp.lang.javascript.
- if the PHP validation doesn't occur/is fault, only then look at the PHP
code, and post here.
Ergo: Now your js doesn't work. Take the outputted pagesource, ask the
people at comp.lang.javascript. If you had done that in the first place, you
might already have had the correct answer.
"No mister builder, you're building a house, there should be furniture in
it, I demand you sell me furniture..."
Grtz,
--
Rik Wasmus
[Back to original message]
|