PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Can I set fields Name Attributes to my values

  1. Hi,

    I've been trying to set a form today to replace one on the client's old basic PHP site. That form submits directly to Moneris for payment. Each field (hidden, text, etc) needs to have its name set to a specific string (ps_store_id, hpp_key, price1, etc) so the receiving page knows what to do with the values entered in those fields.

    The only threads I found on this topic were 1 or 2 years old and said this was not possible then, but I hope this has changed since as I think this would be a pretty common use case. When I use an external URL to submit the form I need to call the fields something the receiving script or page will recognize and know what to do with.

    I set the admin labels to the specific field names but the markup still shows "input_4" or whatever. It doesn't matter if the ID shows that but we need the name attributes to be modifiable. Is that possible with a hook or something?

    Thanks for any help you can provide!

    Posted 8 years ago on Monday February 25, 2013 | Permalink
  2. It's not possible to modify the field names and to continue to have Gravity Forms function properly. To send your information to Moneris, you could use the gform_after_submission hook.

    There have been a couple of other discussions on Moneris I know of:

    Posted 8 years ago on Tuesday February 26, 2013 | Permalink
  3. Thank you Chris!

    As long as their is a way to do it with hooks or otherwise that's great. The first link you gave me seems to contain exactly the info and code I need to get this done.

    I have one more question for now. If I use the code in the second example which provides the remote URL to submit the data to, I suppose I need to set the actual form to submit normally and not to that 3rd party URL directly right?

    Thank you very much!

    (I would appreciate if you could leave this thread open for now if I have more questions regarding this specific process of sending form data to a third party)

    Posted 8 years ago on Tuesday February 26, 2013 | Permalink
  4. That is correct. Don't alter the form tag and don't redirect to moneris. Just process the form like normal and accept the visitor's input, and then send the collected values to moneris with the gform_after_submission hook.

    We'll leave the topic open: no problem.

    Posted 8 years ago on Tuesday February 26, 2013 | Permalink
  5. Hello Chris,

    I've been playing with this and it does post successfully to the remote URL using a modified version with my own variables and $post_url of the code in the second example of your first URL. That is the example code below:

    add_action('gform_after_submission', 'post_to_third_party', 10, 2);
    function post_to_third_party($entry, $form) {
        $post_url = '';
        $body = array(
            'first_name' => $entry['1.3'],
            'last_name' => $entry['1.6'],
            'message' => $entry['3']
        $request = new WP_Http();
        $response = $request->post($post_url, array('body' => $body));

    But this loads the remote response page into the page where where my form was. What I would like is to post the data to the remote page while redirecting to/loading that remote page as if the form had directly submitted to that page on Moneris. On the original site, when a user submits the form, it loads the appropriate page on the Moneris site where they enter their credit card info. They only come back to the original site after payment was completed. The original form gathers data on who they are, what they are paying for, etc.

    Is it possible to post the data to the remote URL while loading that remote page as well? I don't want or need to stay on the page the GF form is on.


    Posted 8 years ago on Tuesday February 26, 2013 | Permalink
  6. If you want them to complete the transaction at Moneris, you probably want to use the redirect option for your confirmation, and send data in the query string. You would not use the gform_after_submission hook in that case. I'm not sure if Moneris allows you to send information in the query string though.

    Posted 8 years ago on Saturday March 2, 2013 | Permalink