Skip to main content
Dec 4, 2006 1:38 PM UTC
Question

Display form data without blank fields. (Coldfusion)

I would like to display data that was enter into a form, but without the fields that were left blank. For example, if someone enters their info in address 1 but left address 2 blank, I want to display address 1 and then display the next completed form field if address 2 was left blank. I am writing this in Coldfusion.

What I am trying to do is allow clients to create and preview a preformatted business card online so we eliminate the back and forth proofing process. The design for each card is the same, but with variable information. Ex., Address 1, Address 2, Cell Phone 1, Cell Phone 2, etc. When fields are left blank I want to eliminate them from being displayed as blank spaces.

Thank you in advance.

Steve Miller
This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Inspiring
Dec 5, 2006 9:53 PM UTC
You might also want to TRIM(Form.Fieldname) first to make sure no spaces
were entered on the form.

<CFIF TRIM(Form.Fieldname) neq "">
#Form.Fieldname#
</cfif>

Doug

"Paul Whitham AdobeCommunityExpert" <design@valleybiz.net> wrote in message
news:el2dks$jo2$1@forums.macromedia.com...
> Just wrap your preview in IF statements like this
>
> <CFIF Form.Fieldname neq "">
> #Form.Fieldname#
> </cfif>
>
> --
> Paul Whitham
> Certified Dreamweaver MX2004 Professional
> Adobe Community Expert - Dreamweaver
>
> Valleybiz Internet Design
> www.valleybiz.net
>
> "mcmcreate" <webforumsuser@macromedia.com> wrote in message
> news:el18d4$4bl$1@forums.macromedia.com...
>>I would like to display data that was enter into a form, but without the
>>fields
>> that were left blank. For example, if someone enters their info in
>> address 1
>> but left address 2 blank, I want to display address 1 and then display
>> the next
>> completed form field if address 2 was left blank. I am writing this in
>> Coldfusion.
>>
>> What I am trying to do is allow clients to create and preview a
>> preformatted
>> business card online so we eliminate the back and forth proofing process.
>> The
>> design for each card is the same, but with variable information. Ex.,
>> Address
>> 1, Address 2, Cell Phone 1, Cell Phone 2, etc. When fields are left blank
>> I
>> want to eliminate them from being displayed as blank spaces.
>>
>> Thank you in advance.
>>
>> Steve Miller
>>
>
>


Translate
Inspiring
Dec 5, 2006 12:14 AM UTC
Just wrap your preview in IF statements like this

<CFIF Form.Fieldname neq "">
#Form.Fieldname#
</cfif>

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"mcmcreate" <webforumsuser@macromedia.com> wrote in message
news:el18d4$4bl$1@forums.macromedia.com...
>I would like to display data that was enter into a form, but without the
>fields
> that were left blank. For example, if someone enters their info in address
> 1
> but left address 2 blank, I want to display address 1 and then display the
> next
> completed form field if address 2 was left blank. I am writing this in
> Coldfusion.
>
> What I am trying to do is allow clients to create and preview a
> preformatted
> business card online so we eliminate the back and forth proofing process.
> The
> design for each card is the same, but with variable information. Ex.,
> Address
> 1, Address 2, Cell Phone 1, Cell Phone 2, etc. When fields are left blank
> I
> want to eliminate them from being displayed as blank spaces.
>
> Thank you in advance.
>
> Steve Miller
>


Translate
Dec 5, 2006 1:03 PM UTC
Thank you Paul. That worked perfectly!

Steve Miller
Translate