Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Popup message

New Here ,
Aug 26, 2008 Aug 26, 2008
I have a form that requires a part number to be entered. In my action page, i query against a table using teh part number,
<cfquery name="qry" datasource=" db">
select partnumber from table
where partnumber = '#form.partNumber# '
</cfquery>

If no matches are found, qy.recordcount is 0, I use cflocation to redirect back to the form with a javascript poppup message :
<cflocation url="form.cfm? showalert& comingfrom= actionpage" >

Back in the form, I check :
<cfif isDefined("showAlert ") and comingfrom is "actionpage" >
<script language = "javascript" >
alert('Part Number not found">
</script>

So if the part number enered is not found, I display a message back on the form. Everything works ok except that as soon as the message is cleared (click ok), it seems to come back when the form is reset or refresh and I get complaints about that.

How can I eliminate the message once it apppears and the ok button is clicked. I only want it to popup once and thats it. Also, somebody suggesed I use showAlert but I have no idea what that does or means.

thanks
431
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 27, 2008 Aug 27, 2008
The reason it's happening is that you have url variables in your cflocation tag and the page refresh doesn't get rid of them.

One way to handle this is to put your javascript on the action page. You'll need two lines, one for the pop up and one to send them back from whence they came.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 27, 2008 Aug 27, 2008
LATEST
Another possible way is to use a session variable for the popup trigger and as part of that trigger's code, clear the session variable after the message is shown.

If you assign the variable on the action page, then they can refresh the form as many times as they want after the initial message w/o getting the message again.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources