Antoher try: break apart form values in the Action file

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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);...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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&amp;fi le=00000545.htm See if that
    helps. - Shawn

    shawnwindler Guest

  6. #5

    Default 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

  7. #6

    Default 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

  8. #7

    Default 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

  9. #8

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139