Hello KDJ,

>This is the very first time I post something, although I've been signed up
>to it for years. I'd like to greet you all first of all :)

And greetings from DownUnder :-)

>Whenever I have a form and I send its contents to another cf document, if
>one of the fields was empty, it interprets the variable as not existant. I.e.
>
><input name="testtext" type="text">
>
>On the next page, if I left that field blank, when trying to do a
>#testtext# it says it doesn't exist.

This is a browser dependent problem. If you do:

<input name="testtext" type="text" value="">

then most browsers will send an empty variable (except extremely old Netscape AFAIK) if there is no entry made.

>That problem wouldn't be so big if it wasn't that today I realized that it
>happens with loops. For example:
>
><cfloop index="nopi" list="black||yellow| |green" delimiters="|">
><cfoutput>My Color is: #nopi# </cfoutput><br>
></cfloop>
>
>It returns:
>
>My Color is: black
>My Color is: yellow
>My Color is:
>My Color is: green
>
>See what I mean? Since the 2nd element is empty, the internal variable just
>doesn't exist...

This is standard CF behaviour with lists. Adjacent delimiters are treated as one delimiter so you need to put something between them. Try something like:
<cfset listVariable = replace(listVariable, "||", "| |", "all")>
That will force the delimiters apart and then you can strip out the spacer afterwards if you need to.

--

Yours,

Kym
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to