View Single Post
Old 03-21-2012, 05:59 PM   PM User | #23
Rowsdower!
Senior Coder

 
Rowsdower!'s Avatar
 
Join Date: Oct 2008
Location: Some say it's everything.
Posts: 2,015
Thanks: 5
Thanked 395 Times in 388 Posts
Rowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura about
Quote:
Originally Posted by komplexbs View Post
I actually used a php variable inside that function :-/

Sorry, I forgot to add the parameter, but the same error still occurs.
I think in the rush to get this fixed you may not be paying full attention to what I am saying. Whether php-generated or not, your HTML source code needs to include single quotes around the value 'zfield_' in order to resolve the javascript error in the page. Once the javascript error is resolved we can work on getting the functionality to do what you actually want it to do.

So if, for example, your php script generates the line like so:
PHP Code:
print "<select class=\"primary\" name=\"Test Field\" id=\"zfield_1\" tabindex=\"1\" onchange=\"ajaxReq(1, this.value, ".$peid.");\">\n"
you would need to amend it to be like this instead:
PHP Code:
print "<select class=\"primary\" name=\"Test Field\" id=\"zfield_1\" tabindex=\"1\" onchange=\"ajaxReq(1, this.value, '".$peid."');\">\n"
Or, if you generate the line like this:
PHP Code:
<select class="primary" name="Test Field" id="zfield_1" tabindex="1" onchange="ajaxReq(1, this.value, <?php print $peid?>);">
then you would need to make it like this instead:
PHP Code:
<select class="primary" name="Test Field" id="zfield_1" tabindex="1" onchange="ajaxReq(1, this.value, '<?php print $peid?>');">
In any case, no matter how you generate the <select> tag and its attributes you *need* to get single quotes around that parameter in the HTML output.
__________________
The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
See Mediocrity in its Infancy
It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
Seek and you shall find... basically:
validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting
Rowsdower! is offline   Reply With Quote
Users who have thanked Rowsdower! for this post:
komplexbs (03-21-2012)