Passer la navigation

[Résolu] I have a Post form with field titled job-url, how can i prepend a value.

This support ticket is created Il y a 1 year, 2 months. 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.

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 -

Fuseau horaire du supporter : Asia/Kolkata (GMT+05:30)

Ce sujet contient 1 reply, a 1 voix.

Dernière mise à jour par Minesh Il y a 1 year, 2 months.

Assisté par: Minesh.

Auteur
Publications
#2800776

Tell us what you are trying to do?

I have a Post form with field titled job-url, how can i prepend a value to the field when submitted.

The user must enter the url for the job into the field.
We have a form that we pass the url through to capture information.

Example,

User enters joburl = "lien caché"

What I need to add to that before it gets int eh database is

"lien caché"
So what gets inserted into the db is

"lien caché"

Is there any documentation that you are following?

I searched but could not find anything to reference this.

Is there a similar example that we can see?

What is the link to your site?

This is the dev site. lien caché

The password is "toolsetrocks"

#2801088

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can use the Toolset form hook "cred_before_save_data" to adjust the value of any of your form field before it gets saved to database.

Add the following hook to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

add_action('cred_before_save_data', 'func_adjust_job_url_field',10,1);
function func_adjust_job_url_field($form_data){
    // if a specific form
    if ($form_data['id']==111182) {
        if (isset($_POST['wpcf-job-url']) and !empty($_POST['wpcf-job-url'])){
            $job_url_link = "<em><u>lien caché</u></em>".$_POST['wpcf-job-url'];
            $_POST['wpcf-job-url'] = $job_url_link;
            
        }
    }
}

More info:
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data