2

I have a form like this..

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

And a submit buttom like this..

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

Jquery and javascrippt functions are:

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();
    });
});

I have to catch my url segment id later in the controller by form post method where i have to handle the id = something Help me to achieve this.

suresh gopal
  • 3,138
  • 6
  • 27
  • 58
tnchalise
  • 1,573
  • 2
  • 18
  • 38

1 Answers1

0

try this it should work

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

and it is not necessary to use jquery.

Runcorn
  • 5,144
  • 5
  • 34
  • 52