2012-12-25 1 views
2

자바 스크립트 함수에서와 POST ..양식의이 같은 형태를 가지고

<?php $form = $this->beginWidget('CActiveForm', array(
    'id'=>'price-form', 
    'enableAjaxValidation'=>true, 
    'enableClientValidation'=>true, 
)); ?> 

그리고는 다음과 같이 buttom의 제출 ..

<?php echo CHtml::submitButton('Save Changes', array('name' => 'Edit','id'=>'submit''));?> 

JQuery와 및 javascrippt 기능은 다음과 같습니다

function checkSum() 
{ 
    //alert(); 
    if(false) 
    { 
     alert('Please Enter valid credintals !'); 
     return false; 
    } 
    else 
    { 
     //i have to post my form, how can i achieve this 
     where where url goes like this 
     controllerName/actionName?id=something 
    } 
} 

$(document).ready(function(){ 
    $("#submit").click(function(e){ 
     e.preventDefault(); 
     checkSum(); 
    }); 
}); 

컨트롤러의 뒷부분에있는 양식 게시 방법에 따라 URL 세그먼트 ID를 잡아야합니다. id = something을 처리해야합니다.도와주세요.

답변

0

<?php echo CHtml::SubmitButton('Save Changes',array('onclick'=>'return checkSum();'));?> 

를 작동해야하고 jQuery를 사용할 필요가 없습니다 이것을 시도.

+0

미리 감사드립니다. 그것은 나를 위해 작동합니다. – TNC