Navigation überspringen

[Gelöst] Auto save when select field value change

This support ticket is created vor 3 Jahre, 10 Monaten. 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 -

Zeitzone des Unterstützers: America/Jamaica (GMT-05:00)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Shane vor 3 Jahre, 10 Monaten.

Assistiert von: Shane.

Author
Artikel
#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
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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
Unterstützer

Sprachen: Englisch (English )

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