Hi all
I have a register form I want to detect if javascript is on or off with. Reason being I want it to either show a nice AJAX form, or something a bit more simple for non JS users.
The current JS detection I use is as follows:
This works fine BUT, if the form submit fails (if certain requirements arent met), it will send info back to the form as a POST, which is swiftly wiped clean when the JS detect form is done lol
Took me about an hour to realise why my AJAX form wasnt getting any errors, but wasnt submitting to the DB either. Now I am stuck, cant seem to find an alternative method.
Other people MUST have had the same problem, unless that is they just dont provide a backup to AJAX forms? Also if I redo my current error reporting to not use POSTS it will mess up numerous other forms in the site
Any ideas?
I have a register form I want to detect if javascript is on or off with. Reason being I want it to either show a nice AJAX form, or something a bit more simple for non JS users.
The current JS detection I use is as follows:
PHP:
<?
if (isset($_POST['jstest'])) {
$nojs = FALSE;
} else {
// create a hidden form and submit it with javascript
echo '<form name="jsform" id="jsform" method="post" style="display:none">';
echo '<input name="jstest" type="text" value="true" />';
echo '<script language="javascript">';
echo 'document.jsform.submit();';
echo '</script>';
echo '</form>';
// the variable below would be set only if the form wasn't submitted, hence JS is disabled
$nojs = TRUE;
}
if ($nojs){
//NO JS
include('register_php.php');
}
else {
//WITH JS
include('register_ajax.php');
}
?>
This works fine BUT, if the form submit fails (if certain requirements arent met), it will send info back to the form as a POST, which is swiftly wiped clean when the JS detect form is done lol
Took me about an hour to realise why my AJAX form wasnt getting any errors, but wasnt submitting to the DB either. Now I am stuck, cant seem to find an alternative method.
Other people MUST have had the same problem, unless that is they just dont provide a backup to AJAX forms? Also if I redo my current error reporting to not use POSTS it will mess up numerous other forms in the site
Any ideas?

