Hi,

 

I need to have the cfloop inside the cfif not the other way

 

so that all session variables  that are mandatory are tested to have a
value.

 

 

 

<cfif

 

<cfloop index=-"i" from 1 to #total_applicants#>

session.applicant#i#_firstname eq '' or 

session.applicant#i#_familyname eq ''

</cfloop> or #loan_amount# eq ''>

 

mandatory fields are missing

 

<cfloop index=-"i" from 1 to #total_applicants#>

<cfif  session.applicant#i#_firstname eq ''><a href="page1.cfm?fielsdname=
applicant#i#_firstname ">Applicant #i# First Name Missing</a> </cfif>

<cfif  session.applicant#i#_firstllastname eq ''><a
href="page1.cfm?fielsdname= applicant#i#_firstname ">Applicant #i# First
Name Missing</a> </cfif>

</cfloop>

 

 

 <cfelse>

 

 

All Mandatory fields are present SUBMIT APPLICATION>

 

 

</cfif>

 

 

 

Regards

Claude Raiola (B.Econ Acc; B.Hot. Mngt)
Samaris Software
Email: [email protected] <mailto:[email protected]> 
Website: www.SAMARIS.net <http://www.TrackingCentral.com.au> 
Mobile: 0414 228 948

 

From: [email protected] [mailto:[email protected]] On Behalf
Of Kai Koenig
Sent: Friday, 10 June 2011 10:22 AM
To: [email protected]
Subject: Re: [cfaussie] cfloop inside a cfif tag

 

You could certainly achieve this with the naming convention you went for,
but it's messy. I'd rather rework the data structure with your session

 

session.applicants = ArrayNew(1);

session.applicants[1] = StructNew();

session.applicants[1]["firstName"] = "Kai";

session.applicants[1]["lastName"] = "Koenig";

...

session.applicants[2] = StructNew();

session.applicants[2]["firstName"] = "Mark";

session.applicants[2]["lastName"] = "Mandel";

...

 

Depending on how you create the structure and what exactly you do to
populate fields in your data structure, you could for instance check

 

<cfloop array="#session.applicants#" index="applicant">

 

            <cfif Len(applicant["firstName"]) or ... >

 

            </cfif>

 

</cfloop>

 

 

Multiple benefits:

 

- Much better datastructure in your session scope instead of gazillion
individual variables

- Less string manipulation and # signs in your loops

 

 

Cheers

Kai

 

--

Kai Koenig - Ventego Creative Ltd

ph: +64 4 476 6781 - mob: +64 21 928 365 /  +61 435 263 414

web: http://www.ventego-creative.co.nz

blog: http://www.bloginblack.de

twitter: http://www.twitter.com/agentK

--

 

Hi

 

I am building an online application form and the last page testes for which
fields across the multi pages of the application form

 

As the application form allows for multiple applicants some of the mandatory
fields only need to be checked dependant on whether there are more than one
applicant entered into the form

 

Each page of the application form captures the data entered and saves the
data into session variables to allow for the values entered across the
application form to remain present as the applicant moves through the
various pages of the application form .

 

If there is a second applicant loaded then session variables relating to the
seconds applicants data are defined

 

eg session.applicant2_firstname, session.applicant2_familyname

 

One the last page I test form mandatory fields with code similar to

 

<cfif

 

<cfloop index=-"i" from 1 to #total_applicants#>

session.applicant#i#_firstname eq '' or session.applicant#i#_familyname eq
''</cfloop>

 

or #loan_amount# eq ''>

 

mandatory fields are missing

 

</cfif>

 

I need to be abel to perform a cfloop within the cfif statement so that the
mandatory fields relating to the 2nd. 3rd or 4th applicants are only tested
for when the value for total_applicants is 2,3 or 4

 

I trust the above makes sense

 

I look forward to your suggestion to achieve the above

 

 

 

 

 

 

 

 

 

 

-- 
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to