Passer la navigation

[Résolu] Reset field on form submission

This support ticket is created Il y a 1 year. 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 6 réponses, a 1 voix.

Dernière mise à jour par Ian Il y a 1 year.

Assisté par: Minesh.

Auteur
Publications
#2808636

Ian

I am trying to reset a form field when a front end form is saved.

I have a custom field "I confirm and agree" slug "confirm"

It is used on a number of forms to hide the submit button with conditional display. A user needs to check the field to confirm it complies with terms and conditions.

I would like it to reset to an empty field value each time a form containing the field is submitted.

#2808716

Minesh
Supporter

Les langues: Anglais (English )

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

Hello. Thank you for contacting the Toolset support.

Do you want to reset the form field value when the form field validatation failed or something?

Can you please share problem URL and tell me what steps I should follow that should help me to see the issue as well as what is your expected workflow.

*** 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.

#2808926

Minesh
Supporter

Les langues: Anglais (English )

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

I can see the form now.

Do you mean that if form validation failed then you want that every time if form validation failed from server side then you want to uncheck the checkbox "I confirm and agree"?

#2809045

Ian

I want to uncheck the checkbox.

#2809134

Minesh
Supporter

Les langues: Anglais (English )

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

When I visit the following page:
- lien caché

I can see the "I confirm and agree"? checkbox is checked.

Do you mean whenever user visits edit form you want to uncheck the checkbox?

#2809159

Ian

I use this form field is as many as a dozen forms. The user needs to check the box to see the submit button. My problem is currently it remembers that the field has been checked. After the form is submitted I need this field to reset so that the user needs to check it again the next time they go to add new or update content.

#2809339

Minesh
Supporter

Les langues: Anglais (English )

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

With your form's custom JS section:
=> lien caché

I've added the following custom JS code:

jQuery(document).ready(function($){
  
  $('input[name="wpcf-confirm"]').trigger('click');

});

Can you please confirm it works as expected.

#2809586

Ian

Works thanks.