Saltar navegación

[Resuelto] 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 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 1 respuesta, tiene 1 mensaje.

Última actualización por Minesh 1 year, 2 months ago.

Asistido por: Minesh.

Autor
Mensajes
#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 = "enlace oculto"

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

"enlace oculto"
So what gets inserted into the db is

"enlace oculto"

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. enlace oculto

The password is "toolsetrocks"

#2801088

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: 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>enlace oculto</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