Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

How can I prevent my page from reloading after the "alert?"

Here's my code:

$workqueueroleassigncheck = cer_workqueueroleassigncheck($tmp_entity[$i]["entityid"], $EntityID, $tmp_user[$k]["userid"]);
					if($workqueueroleassigncheck["count"]>0)
					{
					print '<script type="text/javascript">'; 
					print 'alert("be careful not to assign a role to the same person twice...!")'; 
					print '</script>';  
					}
					else
					{
					$workqueueroleassignsave = cer_workqueueentityassignsave($tmp_role[$j]["roleid"],$tmp_entity[$i]["entityid"],$EntityID, $tmp_user[$k]["userid"], $updateuserid);
					}

Open in new window


Basically, if the user attempts to add a record that's a duplicate of what's already in place, they get an alert and the insert code doesn't fire.

Problem is, I don't want the page to reload. Is there a way to structure my code where the checkboxes that had been checked remain so rather than the page reloading?
Avatar of kaufmed
kaufmed
Flag of United States of America image

What web framework are you using? PHP? ASP/ASP.NET? Other?

If ASP.NET, do you have your controls set to auto-postback?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial