Loading Indicator

Hi all, i would like to add a loading indicator on form submit. In server when i submit a form, it take much time for submission so on submit click i want to show a loading/progress indicator. In normal form submit how can i add an indicator?


The easiest way is to place the loading image on your page an hide it with css. When the user submits the form set the loading image to display:block.


$('<cssSelectorOfTheForm>').on('submit', function (e) {



Example form

$form = $this->beginWidget('CActiveForm');

<div class="row">

    <?php echo $form->labelEx($model,'firstName'); ?>

    <?php echo $form->textField($model,'firstName'); ?>

    <?php echo $form->error($model,'firstName'); ?>


<div class="loading">

  <img src="<pathToLoadingCircle>" />