Skip Navigation

[Resolved] submit at onchange in a list (view)

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by francescoG 1 year, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2561993

Tell us what you are trying to do?
Good evening
I have this cred form

[credform]
<div class="container-fluid">
<div class="row">
<div class="form-group col-md-6">
<label for="%%FORM_ID%%_progress-state">[cred_i18n name='progress-state-label']Progress state[/cred_i18n]</label>
[cred_field field='progress-state' force_type='field' class='form-check-input' output='bootstrap']
</div>
<div class="col-md-6">
[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
</div>
</div>
</div>
[/credform]

and I inserted it in a view list
It work but I'd want the submit start at when radio button will change.
How can I inject the subit at onchange javascript script?
is there other solution?

Thanks

#2562761

Hello,

It is possible with custom JS codes, see below test site:
Login URL: hidden link

Post form with radio field:
hidden link
in section "JS Editor", use below JS codes:

jQuery(document).on('cred_form_ready', function() {
	jQuery('input[name=wpcf-progress-state]').on('change', function() {
      	var form_id = jQuery(this).closest('form').attr('id');
      	var submit_id = form_id + '_form_submit_1';
    	jQuery( '#' + submit_id).click();
    });
});

Test it in frontend:
hidden link

It works fine

#2562827

it works but just for the first radio. I have iterated the form with radio in a view list and it not works for the second and the others

#2563487

Please try to modify the JS codes as below:

jQuery(document).on('cred_form_ready', function() {
	jQuery('input[name=wpcf-progress-state]').on('change', function() {
      	var form_id = jQuery(this).closest('form').attr('id');
      	var submit_id = form_id + '_form_submit';
    	jQuery( 'input[id ^= ' + submit_id + ']').click();
    });
});

It works fine in above test site:
hidden link

#2563569

It works fine. My issue is resolved now. Thank you!