Skip to main content
Known Participant
August 27, 2008
Question

Popup message

  • August 27, 2008
  • 2 replies
  • 561 views
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
    This topic has been closed for replies.

    2 replies

    Inspiring
    August 27, 2008
    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.
    Inspiring
    August 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.