Skip to main content
Inspiring
November 4, 2010
Question

Saving Formfield Values in Group

  • November 4, 2010
  • 2 replies
  • 702 views

This may be an obvious question, but I'm stumped. Is there a way to save a "group" of formfield values to be accessed at another time?  In particular, I would like to save all of the hidden form fields and their values in one group that can be called by the one saved group name.

I am using PayPal IPN.  When PayPal returns its response to my IPN file, I want to access all of the form fields that were in my form prior to sending to PayPal.  I have fields in the form other than the PayPal fields (more than one custom field).

Is there a way for me to group and save all of the formfield values from my form being submitted to PayPal and access them again when the PayPal IPN returns to my site?

    This topic has been closed for replies.

    2 replies

    ilssac
    Inspiring
    November 4, 2010

    There is NO way to group form fields by anything other then their name.  After being submitted by a browser all that form field become are post key-value pairs in the request header.  There is no grouping of any kind in these pairs in the current HTTP standard.  That leaves the form names as the only option.  If you want to group a set of fields together, append or prepend a string to the form name to group them.

    I.E. to group a set of hidden field you could do this obvious naming scheme:

    <form name="hidden_aField"....>

    <form name="hidden_bField"....>

    <form name="hidden_cField"...>


    Then it is relatively easy to access these on the server response page, especially with array notation syntax.

    <cfloop collection="form" item="field">

       <cfif left(field,7) EQ 'HIDDEN_">

               <!--- Do stuff with a hidden field --->

              <cfoutput>#form[field]#</cfoutput><!--- very simple example of array notation with the form scope --->

       </cfif>

    </cfloop>

    HTH

    Ian

    Inspiring
    November 4, 2010

    Thank you both for your responses.

    I'm wanting to use the hidden form values 2 page clicks away rather than the immediate server response page.

    page 1 is form with hidden fields

    page 2 goes offsite

    page 3 comes back onsite and wants to access page 1 form fields

    ilssac
    Inspiring
    November 4, 2010

    Balddog4 wrote:

    page 2 goes offsite

    If the offsite response page does not forward the submitted form key-values, there is no way to get them yourself.  But IIRC I thought the Pay Pal IPN API did forward all form fields to your handler page.  But it has been years since I worked up my solution and it hasn't need touching in all that time.

    Inspiring
    November 4, 2010

    If it all happens in the same session,

    session.something = structcopy(form);