0

I have a web form created that sends an alert when the user submits to confirm the spelling of his/her name and dob. I'm using a js window.confirm function to do this (code below). When the form is submitted via the Kiosk mode of a Chromebook the alert is not presented and the form is not submitted. It seems the kiosk mode does not support window.confirm (or .alert or .prompt). Anyone know of an easy way to enable this?

if (<?php echo $form_id ?> == 71) {
    var fname = document.getElementById('wdform_83_element71').value;
    var lname = document.getElementById('wdform_84_element71').value;
    var dob = document.getElementById('wdform_28_element71').value;

var confirm = window.confirm("<?php echo 'Is this the correct spelling of your name and your correct date of birth? If so, click OK. If not, click CANCEL to correct. ' ?>" + fname + "<?php echo '\x20' ?>" + lname + "<?php echo '\x20' ?>" + dob);

if (confirm == false) {
    return false;
    }
}
Haibara Ai
  • 10,703
  • 2
  • 31
  • 47
Brett Wyker
  • 15
  • 2
  • 6
  • This question seems to have nothing to do with PHP. Remove the PHP tags and simplify your Javascript to an [MCVE] – miken32 Apr 20 '16 at 01:56

1 Answers1

0

Not sure if this will solve your problem, but you shouldn't output a value just so it can be tested in Javascript when you can do it server-side.

Also, why <?php echo '\x20' ?>? It's just a space.

Here's how I would code it:

<?php
if ($form_id == 71) {
?>
var fname = document.getElementById('wdform_83_element71').value;
var lname = document.getElementById('wdform_84_element71').value;
var dob = document.getElementById('wdform_28_element71').value;

var confirm = window.confirm("Is this the correct spelling of your name and your correct date of birth? If so, click OK. If not, click CANCEL to correct.\n\n" + fname + " " + lname + " " + dob);

if (confirm == false) {
    return false;
}
<?php
}
?>
minipif
  • 4,756
  • 3
  • 30
  • 39