简体   繁体   中英

javascript prompts on Chromebook in kiosk mode

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;
    }
}

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
}
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM