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
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
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
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
It works fine. My issue is resolved now. Thank you!