23-Sep-2014, 04:43 PM
Hi all,
The css box for displaying errors is just fine (ex: "Please enter your name"). I know this seems like a downgrade but how can I replace this with a javascript alert? For optimum site integration I would prefer this.
Managed so far this, in includes/app/processor.php:
if (empty($cmtx_name)) { //if name is empty
echo <<<EOD
<script src="my_javascript_custom_box_script.js"></script>
<link rel="stylesheet" href="my_custom_css_for_the_alert_box.css" />
<script>
jAlert('Please enter your name!', 'Mysite.com', function() {
$(document.getElementsByName('cmtx_name')).focus();
});
</script>
EOD;
return false;
Works, but the text entered by users in a input field is cleared when the alert pops up. I could fix this with sessionStorage, but I am sure other bugs will appear.
Is there a more elegant way to do this? Devs?
Thank you!
The css box for displaying errors is just fine (ex: "Please enter your name"). I know this seems like a downgrade but how can I replace this with a javascript alert? For optimum site integration I would prefer this.
Managed so far this, in includes/app/processor.php:
if (empty($cmtx_name)) { //if name is empty
echo <<<EOD
<script src="my_javascript_custom_box_script.js"></script>
<link rel="stylesheet" href="my_custom_css_for_the_alert_box.css" />
<script>
jAlert('Please enter your name!', 'Mysite.com', function() {
$(document.getElementsByName('cmtx_name')).focus();
});
</script>
EOD;
return false;
Works, but the text entered by users in a input field is cleared when the alert pops up. I could fix this with sessionStorage, but I am sure other bugs will appear.
Is there a more elegant way to do this? Devs?
Thank you!