Hi guru’s,
I have a stange problem that i am having with some javascript in a form.
Here is my code;
[CODE]<input name=”u_address1″ type=”text” id=”ua1″ value=”<?php echo $row[Address1] ?>” class=”100text” onchange=”<?php $ad->tc(); ?>return gpo_check(‘ua1’,1);append_act(‘main_sh_update<?php echo $row[ContactID] ?>’,’&em=ua2′);<?php $ad->stf() ?>”>
I am having problems getting functions to execute AFTER the return function “return gpo_check()” in the above code. Do functions after a return function not execute in javascript as a general rule or?
Ps. <?php $ad->stf() ?> is simply “this.form.submit();”.
My gpo_check() function is this.
[CODE]//Check the addresses to make sure they are not PO or GPO boxes
function gpo_check(data)
{
var error=”;
<?php //Grab the values from the table
$sql=”select * from restricted_address_terms order by term asc”;
$i=0;
$get_t=$sc->do_q($sql);
while($row=mysql_fetch_array($get_t[0]))
{
if($i==’0′)
{
$terms=$row[term];
}
else
{
$terms.=”|$row[term]”;
}
$i++;
}
?>
var cw='<?php echo $terms ?>’;
var cw_x=cw.split(“|”);
for(i=0;i<cw_x.length;i++)
{
if((document.getElementById(‘u_d_flag_0’).checked==true)|(document.getElementById(‘u_s_flag_0’).checked==true)|(document.getElementById(‘uadflag_0′).checked==true))
{
if(document.getElementById(data).value.match(cw_x[i]))
{
error=’Sorry but you cannot use post addresses as an address’;
}
}
}
if(error!=”)
{
alert(error);
document.getElementById(data).focus();
return false;
}
else
{
return true;
}
}
What am I doing wrong?
Like i said it executes the functions BEFORE the return check_gpo() function, I really need it to execute the functions after it.
Cheers
Sn0rcha