/    Sign up×
Community /Pin to ProfileBookmark

Execute another function after a return type function.

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() ?>”>[/CODE]

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;
}
}[/CODE]

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

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @sn0rcha spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...