Skip to main content
Inspiring
July 8, 2008
Answered

Problem with ListAppend()

  • July 8, 2008
  • 3 replies
  • 638 views
Code Attached...

I am writing some code that validates form data and upon finding something that is not correct, I would like to add the error message to a list.

Then when the validation is complete i can use a cfloop and create a list of the errors that are on the form for the user to resolve...

This should not be hard and I have no clue what I have wrong here... I have looked everything up and it should be working, but when I cfoutput my formErrorMsgs variable i get nothing and my list is empty to...

The flag "formError" is getting set to true somewhere because the error box displays... just empty...

Thanks for your help!
    This topic has been closed for replies.
    Correct answer josheby
    ListAppend needed to be the following:

    <cfset formErrorMsgs = ListAppend(formErrorMsgs,"Error Message","|") />

    3 replies

    Inspiring
    July 8, 2008
    jeby wrote:
    > ListAppend needed to be the following:
    >
    > <cfset formErrorMsgs = ListAppend(formErrorMsgs,"Error Message","|") />

    I feel for you. I understand why ListAppend() is like this, but I often
    write it like I would write ArrayAppend() or many other CF append
    Functions.
    joshebyAuthorCorrect answer
    Inspiring
    July 8, 2008
    ListAppend needed to be the following:

    <cfset formErrorMsgs = ListAppend(formErrorMsgs,"Error Message","|") />
    Inspiring
    July 8, 2008
    You might want to re-read the docs for listAppend(), I think.

    Especially the usage notes, and any comment on *what the function returns*.

    http://livedocs.adobe.com/coldfusion/8/functions_l_04.html

    --
    Adam