sakaw
(Sakaw 03)
1
hello …
I want to ask, I put js in SubmitButton like the example below.
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('onclick'=>'{displayDate();}')
function displayDate()
{
confirm("Price :"+$("#Batch_price").val() * $("#slot").val().length +"\nSlot:"+$("#slot").val()+"\n\n Are Your Sure??");
}
even if I click cancel, the form data was sent to the controller for the validation
how to make when clicking cancel does not happen anything?
h3rm
2
What do you mean like this:
if(!confirm("Price :"+$("#Batch_price").val() * $("#slot").val().length +"\nSlot:"+$("#slot").val()+"\n\n Are Your Sure??")return false);
sakaw
(Sakaw 03)
3
I tried code like this
echo CHtml::submitButton(
$model->isNewRecord ? 'Create' : 'Save',
array(
'ajax'=>array(
'type' => 'POST',
'url'=>CController::createUrl('dialog'),
'data'=>array('price'=>'js:$(\'#Batch_price\').val()',
'slot'=>'js:$(\'#slot\').val()',
),
'success'=>'js:
function(id){
confirm(id);
}',
),
));
I managed to bring up a pop-up message with the attribute of the form
but i can not save data into the database …
please help meee…
TickTack
(Pwcio)
4
use Firebug (firefox plugin) to check response data from server 