Skip to main content
Inspiring
March 13, 2008
Question

Error messages

  • March 13, 2008
  • 1 reply
  • 392 views
I use javascript to edit and have popup error messages. I also use cfinput for popup error messages. However, there are some that must be submitted to the server for validation, such as ldap. I submit the payroll number on my form and this is what I do to get messages somewhat consistent.
In the action page, I query and if the payroll number is not found,
<cfif qryldap is "0">
<cflocation url="back_to_form.cfm">

I force a retur to the forms page and the output the error message :
<script language="javascript">
alert ("Payroll Number not found")>
</script>

This works ok because the error message does popup in the forms page, so it is consistent with the others.

The problem/question is when they click refresh, the error message always seems to be there and pops up all the time. How can I eliminate that from happening ? I only want it to popup once, to let them know that it is an invalid payroll number, not each time they refresh or enter the form.

Thanks
    This topic has been closed for replies.

    1 reply

    Inspiring
    March 13, 2008
    Not sure if this is the most elegant solution, but why don't you try using a URL variable...

    <cfif qryldap is "0">
    <cflocation url="back_to_form.cfm?showAlert">
    </cfif>

    <cfif isDefined("url.showAlert")>
    <script language="javascript">
    alert ("Payroll Number not found")>
    location.href='back_to_form.cfm';
    </script>
    </cfif>
    trojnfnAuthor
    Inspiring
    March 13, 2008
    The concept is the same, but if this is a better solution, I will give it a try.

    Will this clear the messages each time, such as the problem that I am having ?
    Inspiring
    March 13, 2008
    No matter how many times they refresh the page, the JS alert will only fire if 'showAlert' is in the URL.