kamal213 Posted January 22, 2014 Share Posted January 22, 2014 Hi all, I have an issue on my javascript code which I'd like you help with. I have a form validator functionality which check if a value is filled onsubmit and alerts then if its not. it looks like so: <script type="text/javascript"> function validate_form ( ) { valid = true; if (document.acform.c_city1.value == "") { alert ( "Please note the first box must be filled to create a result" ); valid = false; } return valid; } </script> Now this works perfectly fine no issues at all. The problem comes when I tell the above function to do something else. Which looks like so: <script type="text/javascript"> function validate_form ( ) { valid = true; if (document.acform.c_city1.value == "") { alert ( "Please note the first box must be filled to create a result" ); valid = false; } if ( (document.acform.c_city1.value != "") && (document.acform.c_city2.value != "") ) { window.open("<?php echo 'town1.php?c_city1=' . $c_city1 . '' ?>"); window.open("<?php echo 'town2.php?c_city2=' . $c_city2 . '' ?>"); } return valid; } </script> From the above, the second if statement, am asking it to open two windows, but then none of the statements work and I then get the following error: Message: Unterminated string constant Line: 20 Char: 20 Code: 0 Message: Object expected Line: 2 Char: 1 Code: 0 Please I need you help as I can see any obvious errors and don't know why it doesn't work at all. Many thanks Link to comment https://forums.phpfreaks.com/topic/285586-open-multiple-windows/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.