Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Howard Perlman #1
Antoher try: break apart form values in the Action file
Still trying here. I have a form that passes multiple NAMEs from a CFSELECT
TYPE='TEXT'. I use this to pass them: <cfselect type='text' name='theDate_#i#'
value='#adate#'> ('i' is a counter) A query loop makes multiple lines. So, the
values (form.value) I get in the Action file from the form might be:
'3/3/2003_1' '4/12/2004_2' '5/23/2003_3' So, how can I loop through these
and extract the date only? <cfloop index='N' from='1' to='#nrec#' step='1'>
<cfset theRecord = '#form.finishdate_#N##'> This don't work! Any ideas?
Thanks,
Howard Perlman Guest
-
How to access values of form fields on am action page?
I am sending few form fields to the action page. Here is what it receives (from CF debugging info): Form Fields: 58707001=TBD 587627_01=TBD... -
Populate form values based on previous same form fields
This message is cross posted in alt.comp.lang.php & comp.lang.javascript I have a form for a user to input an establishment's hours and what time... -
Form submission fills form values with garbage
Hey all, I'm attempting to do some form processing on a server that has register_globals off, however, I've run into a confusing situation and... -
web form add a line break to a place holder
have a web form with page layout = FlowLayout have a PlaceHolder adding controls to the PlaceHolder e.g. PlaceHolder.Controls.Add (TextBox1);... -
form action
What does "doesn't seem to work" mean? (asp.general removed from x-post list) "rOadhOg" <roadhog@nospam.phreaker.net> wrote in message... -
shawnwindler #2
Re: Antoher try: break apart form values in the Actionfile
First off... What is the TYPE='text' attribute in a CFSELECT? Second, when
you submit the form, the form variables you get in your action page will be
like Form.theDate1 Form.theDate2 Form.theDate3 etc. And those fields will
contain whatever was selected in the CFSELECTs. Does that sound right or did I
totally miss your point? - Shawn
shawnwindler Guest
-
Howard Perlman #3
Re: Antoher try: break apart form values in the Actionfile
Thanks. Oops - I've had such a hard time explaining this that I keep shortening
my questions! So, I messed it up. Ture, I meant the CFINPUT line, such as:
<cfinput type='Text' name='FinishDate_#rec#' value='#strCompleteDate#'> or,
even better would be: <cfinput type='Text' name='FinishDate_#EmployeeName#'
value='#strCompleteDate#' You are right, I think. I do get 'form.theDate_1',
'form.theDate_2' ... 'form.theDate_Reccount' (reccount=total number of records)
And, for instance, the first one will really be: '3/03/2005_1' But I can't see
how to loop from 1 to #reccount# and make an array, let's say, of just the
dates (getting rid of rest of it). But, what I really need to do, I think, is
attach the employee name to the date instead of a counter number. Then if I
could break them apart, maybe I could get an array of Employee name/Dates.
Since Employee is the database table key, I could use SQL WHERE to write the
new dates to the proper employee in the database. That would be much better
than using a number. Does this help? Thanks for any help. Howard P.
Howard Perlman Guest
-
shawnwindler #4
Re: Antoher try: break apart form values in the Actionfile
Well, if the form data that you are receiving looks like 03/04/2005_FirstName
LastName Why don't you just split that string based on the underscore '_'. You
can use string manipulation such as Left, Right, Mid, Find, Len.
[url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/[/url]
wwhelp.htm?context=ColdFusion_Documentation&fi le=00000545.htm See if that
helps. - Shawn
shawnwindler Guest
-
Howard Perlman #5
Re: Antoher try: break apart form values in the Actionfile
Right. Yes, that is what I'd like to do (and I could do it if I use a single
NAME attribute, since all the values seem to be sent as a comma delimited list
(CF7 only, it seems). But, what i can't see is how to loop through all the
values that come in to the Action file. In other words, I know my variable
coming in might be called: 'form.finishdate_1' and 'form.finishdate_2'. But I
tried a loop, such as: <cfloop index='num' from='1' to='#nrec#' step='1'>
<cfset theRecord = '#form.finishdate_num#'> Also tried: <cfset theRecord =
'#form.finishdate_#num##'> They both give errors. Even tried <cfset theRecord
= '#form.finishdate_#evaluate(num)##'> And, yes, I could break them apart
(<cfset delimetercolumn= REFind ('_',#theRecord#,1)>).... if... Does this help
explain? Thanks again
Howard Perlman Guest
-
shawnwindler #6
Re: Antoher try: break apart form values in the Actionfile
Perhaps looping through the list? <cfloop list='#Form.NAME#' index='val'>
<cfset theDate = Left(val, Len(val) - Find('_', val))> <cfset thePerson =
Right(val, Len(val) - Len(theDate))> </cfloop> Something like that might work.
You might need to subtract 1 here or there. I didn't check the math out when
doing the Len calculations. Lemme know if that helps. - Shawn
shawnwindler Guest
-
Howard Perlman #7
Re: Antoher try: break apart form values in the Actionfile
Shawn, So, are you saying to use the LIST method I talked about above? I mean,
using a single NAME attribute instead of a unique one for each row? Problem is,
then I'd have to attach the Employee name (or number) to the VALUE field, which
messes up the entry in the box. But, maybe you don't mean that. You may mean
loop through the form names using multiple NAME attributes as we've been
discussing)? But, trying '<cfloop list='#Form.NAME#' index='val'> ' gives an
error, since there is no form.name, but only form.name_1, form.name_2, etc.
So, you see the exact problem - trying to loop through a set of things that are
named differently? Sigh, not much fun, this. Thanks...
Howard Perlman Guest
-
shawnwindler #8
Re: Antoher try: break apart form values in the Actionfile
Sorry I kinda switched horses midstream there. My last post referred to the
single name attribute. For example, name all your CFINPUTs the same. Then you
can loop through that list using CFLOOP list='form.whateveryounamedthecfinput'
index='val' Then break apart the val to get the data you want. Run your
CFQUERY inside the loop. Try that and let me know. Once again, sorry for that
confusion. - Shawn
shawnwindler Guest



Reply With Quote

