mhmmadsa
(Mohmmad Zoheer2)
1
[b]hi … i need help asap (code) please !!
iam using yii 1.1[/b]
[size="5"]i need to save checked value automatically without submit button or the same checkbox is submit; [/size]
Hi,
Can you share your view file snippet?
mhmmadsa
(Mohmmad Zoheer2)
3
in view:
<?php echo $form->switchGroup($model, 's_check_support',
array(
'widgetOptions' => array(
'events'=>array(
'switchChange'=>'js:function(event, state) {
console.log(this); // DOM element
console.log(event); // jQuery event
console.log(state); // true | false
}'
)
)
)
); ?>
i need “code”, functions to active DOM element, jQuery event and state !! i don’t know any things about that.
but no problem if you have any ways to solve what i need (((change value in database auto. on click checkbox)))
if you have any description:
Hi,
This code may help you
<?php
echo $form->switchGroup($model, 's_check_support', array(
'widgetOptions' => array(
'events' => array(
'switchChange' => 'js:function(event, state) {
if($(this).is(":checked")){ //May vary based on the widget you are using
//Make your ajax request
$.post(YOUR_BASEURL/CONTROLLER_ID/ACTION,{s_check_support:$(this).val()},function(data){
//AJAX Response
});
}
}'
)
))
);
?>
In your controller create a action or add a parameter to existing action and update the model