Skip Navigation

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

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 -

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

This topic contains 1 reply, has 1 voice.

Last updated by Minesh 4 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#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 = "hidden link"

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

"hidden link"
So what gets inserted into the db is

"hidden link"

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. hidden link

The password is "toolsetrocks"

#2801088

Minesh
Supporter

Languages: English (English )

Timezone: 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>hidden link</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