Sauter la navigation

[Résolu] Auto save when select field value change

This support ticket is created Il y a 3 années et 8 mois. 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par Shane Il y a 3 années et 8 mois.

Assisté par: Shane.

Auteur
Publications
#2155503

I have a form with only one "select" dropdown field.
Is it possible to automatically submit the form every time the select field's value is changed?

Thanks

#2155635

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hello,

This is not possible by default but you should be able to achieve it by using some javascript to trigger the action.

You can use the link below as it provides an example on how to do this.

https://stackoverflow.com/questions/28122019/how-to-submit-form-on-select-change/35418634

Please let me know if this helps.

Thanks,
Shane

#2155703

I was trying

jQuery("input[type='select']").change(function() {
jQuery(this).submit();
});

but somehow I cannot get it work.

Do I miss something?

#2155721

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hello,

Can you try this.

jQuery(document).ready(function() {
  jQuery('input[type='select']').on('change', function() {
    var $form = jQuery(this).closest('form');
    $form.find('input[type=submit]').click();
  });
});

Please let me know if this works.
Thanks,
Shane