Skip to content Skip to sidebar Skip to footer

Javascript For A Form On The Server-side?

The question emerges from the discussion with Christoph in my last question 'HTML: target=”_blank” for a drop-down list' and the alternative method by Andrew. Problem: to run c

Solution 1:

Actually, it depends on the server-side language you're going to use.

But, it's as simple as reading out the values in the POST and GET Values the Form delivers you.

i.e. PHP:

if($_POST["js_enabled"] == 0)  
{  
   doSomething(); // Redirecting   
}

But don't forget to validate all values.

good luck, rAyt

Edit

There you go (pretty good answer though)

How are POST and GET variables handled in Python?

Solution 2:

There's no need for any additional code or checking for scripting on the server side: Because of the return false in the onsubmit handler, the form won't be submitted if the handler is executed!

Returning false from event handlers supresses the default action associated with the event the same way as calling event.preventDefault() (event.returnValue = false in IE) does.

Post a Comment for "Javascript For A Form On The Server-side?"