Forums

Set Hidden field value in the submit event

annekm 02 Apr, 2018
Hello,

I have to send a field data to the Payment Gateway. I have designed a hidden field to store the value. But this value will be the unique key of the data entered by the user inserted in the DB.

Upon submit, I have a DB Save event that saves the submitted data. I then read the unique key of the record just saved and set the form data for the hidden field name. Then the payment gateway action is setup.

But the hidden field is not passed correctly. How could this be setup correctly?









Regards,
Anu
GreyHead 02 Apr, 2018
Hi Anu,

As you don't know the unique key until after the form data is saved you don't need to use a hidden input for the value.

And I do not understand the series of DB Saves and DB Reads that you are using. The uid (if that is the key you are using*) will be available in the form data after the first DB Save. You can use a Debugger action to see the value and check.

You should then be able to reference that value directly in whatever action you are using to connect to the Payment Gateway (I don't see that in your post).

Bob

* Personally I find the CF generated UIDs a bit long for some purposes and prefer to use shorter random strings - in that case you do need a DB Read loop to check for uniqueness. My Unique ID [GH] action for CFv5 could handle that for you.
annekm 03 Apr, 2018
Hi GreyHead,

In the Payment Gateway action the field is set using the following code:
$postFields .= "&udf1=".$_REQUEST['cname'];

So, the form data is not getting passed to the action. Can I modify the code to read the form data?

Regards,
Anu
annekm 03 Apr, 2018
Hi GreyHead,

Thanks for the heads up. I modified the code of the actions to read the form data instead of the $_REQUEST array and it worked.

Thanks for your support.

Regards,
Anu
This topic is locked and no more replies can be posted.