Skip Navigation

[Resolved] Passing parameters and values in CRED form submit

This thread is resolved. Here is a description of the problem and solution.

Problem:
Passing parameters and values in CRED form submit

Solution:
Tooslet Forms offers the hook: cred_success_redirect which you can use to redirection to your desired page where you can pass URL prams as required.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/passing-parameters-and-values-in-cred-form-submit/#post-1264923

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by Mario 5 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1264727

Tell us what you are trying to do?
I have a update form and want to pass a value in the submit to the next page url.com?abd1=post-id&abc2=cpt-field-name

[cred_field field='form_submit' output='bootstrap' value='Next' class='btn btn-primary btn-lg']

Can you give me an example of how to use the urlparam argument. or another way to pass a CPT field and post-id.

Many thanks

#1264923

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - Tooslet Forms offers the hook: cred_success_redirect which you can use to redirection to your desired page where you can pass URL prams as required.

For example:

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data){
    if ($form_data['id']==9999)
        return 'url.com?abd1=post-id&abc2=cpt-field-name';
   
    return $url;
}

Where:
- Replace 9999 with your original form ID.
- Adjust the code as required

More info:
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

#1265193

Thank you.

return 'url.com?abd1=post-id&abc2=cpt-field-name';

Thank you. The problem I am have is adding the values as when contained within the quote marks ' ' that contains the url. how do I insert the fields without breaking the function.

return 'hidden link';

#1265245

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you can tell me what fields/URL prams you want to pass and to what URL I can try to share the solution.

If it possible fore you to send me access details?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1265353
return-php1.png

With the greatest respect.
I'm not sure why i need to carry out a full backup.

return 'hidden link';

This does not work because of the field values are not picked up due to being requested with in the quote marks, There are seen as just text.

I'm looking for the php code to add arguments and there values. so the values are picked up.

These are the names of the actual fields i require:
cp-first-name is the name of the CPT field.
$post_id

#1265443

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

you should try to use the following code - I've concate the string so values should be appended now.:

return '<em><u>hidden link</u></em>'.$post_id.'&abc2=cp-first-name';
#1267253

Minesh thank you for your help.

My issue is resolved now.