M
M
Mikha Pankratov2015-12-07 21:16:44
JavaScript
Mikha Pankratov, 2015-12-07 21:16:44

How to make ajax events on radioList?

Hello,

there is a radiolist in the form

$form->field($model, 'radiovar')->radioList([1 => 'Yes', 0 => 'No'])


Do I need to click on ess to change the data in the database in the table in which I generate in the model and display the hidden fields that need to be filled in? Has anyone done this?

Thanks for the help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2015-12-08
@devalex89

as I understand it, it's about an AJAX
request to save the current values
​​​​and show new fields
without reloading the page
then to help JQuery:

$('input[type=radio]').change(function(){
   var form = $(this).parens('form');
   $.post(url, form.serialize(), function(resp){
       if(resp=='OK') //показ остальных полей
   });
});

example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question