Navigation überspringen

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

This support ticket is created vor 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 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 1 reply, hat 1 Stimme.

Zuletzt aktualisiert von Minesh vor 1 year, 2 months.

Assistiert von: Minesh.

Author
Artikel
#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 = "versteckter Link"

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

"versteckter Link"
So what gets inserted into the db is

"versteckter 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. versteckter Link

The password is "toolsetrocks"

#2801088

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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>versteckter 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