can we safely assume that all of the dynamically named fields will
contain underscores and the static fields will not? if so, that'd be
kinda groovy, 'cuz then you should be able to do:
<cfif (find("_", i) GT 0) AND (len(trim(form[i])) GT 0)>
also, throw a trim() inside the len() function to handle any spaces in
the form field value.
On 12/18/06, Bruce Sorge <[EMAIL PROTECTED]> wrote:
> That did not work Charlie. Not only is it giving me the two static fields,
> but also the hidden field and the submit button name.
> I did try this though:
> <cfif FindNoCase("Name_",i) OR FindNoCase("Phone_",i) OR
> FindNoCase("Email_",i) AND LEN(form[i] GT 0)>
>
> This did exclude all of the fields except the ones I want, but it is also
> giving me all of the empty ones. If I just do this:
>
> <cfif FindNoCase("Name_",i) AND LEN(form[i] GT 0)>
>
> Then I get all of the fields with Name_ in them but nothing else. Surely I
> am missing something basic?
>
> On 12/18/06, Charlie Griefer <[EMAIL PROTECTED]> wrote:
> >
> > <cfif ((i IS NOT "static_field1") OR (i IS NOT "static_field2")) AND
> > (len(form[i]) GT 0)> ?
> >
> > On 12/18/06, Bruce Sorge <[EMAIL PROTECTED]> wrote:
> > > Not sure really.
> > > What I have are a total of five dynamically named form fields. They are:
> > >
> > > Name_X, Phone_x, Email_X for the first group, then
> > > LanguageName_x, LanguageSpoken_x in the second group.
> > >
> > > The first group of information goes into one table and the second group
> > of
> > > information goes into the second table. I have a hidden form field that
> > > enters a FK into these tables that is linked to another table that has
> > > already been populated with part one of the form. (this is a two part
> > form).
> > >
> > > There are a total of 10 rows for each group, but not all 10 rows are
> > going
> > > to be filled out all the time. There are some instances where only one
> > or
> > > two rows will be filled out, so that is why I am doing the LEN function.
> > I
> > > will get rid of the evaluate function and see what happens.
> > >
> > > I am having one problem though. There are two other fields in this form
> > that
> > > go into the master table, so I need to exclude these from the array. I
> > am
> > > doing a FindNocase function and it works fine when I put in only one of
> > the
> > > fields (like <cfif FindNoCase("phone_",i) AND LEN(form[i])> and it gets
> > all
> > > of the fields with phone just fine, but when I add other fields to it,
> > > nothing happens. So since I know the other two fields are not dynamic,
> > how
> > > can I exclude them from this so I get only the information I need?
> > >
> > > Bruce
> > >
> > > On 12/18/06, Charlie Griefer <[EMAIL PROTECTED]> wrote:
> > > >
> > > > so, just out of curiousity...why do you need this array?
> > > >
> > > > you also don't need the evaluate(). you can simply do form[i] (which
> > > > is -exactly- what you're doing in your conditional where you're
> > > > testing len(form[i]).).
> > > >
> > > > On 12/18/06, Bruce Sorge <[EMAIL PROTECTED]> wrote:
> > > > > OK, I figure it out so please disregard the last message.
> > > > >
> > > > > I did it like this:
> > > > >
> > > > > <!--- Create the initial array --->
> > > > > <cfset languageArray= ArrayNew(1)>
> > > > >
> > > > > <!--- Loop through the form fields and get the names of them--->
> > > > > <cfloop index="i" list="#form.fieldnames#">
> > > > > <!--- If the field is not empty, get the info --->
> > > > > <cfif LEN(form[i])>
> > > > > <cfset languageArray[1][1] = #i#>
> > > > > <cfset languageArray[1][2] = #evaluate("form.#i#")#>
> > > > > <!--- Query will go here soon --->
> > > > > </cfif>
> > > > > </cfloop>
> >
> > --
> > Charlie Griefer
> >
> > ================================================
> > "...All the world shall be your enemy, Prince with a Thousand Enemies,
> > and whenever they catch you, they will kill you. But first they must catch
> > you, digger, listener, runner, prince with a swift warning.
> > Be cunning and full of tricks and your people shall never be destroyed."
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264398
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4