Inheritance: extends sfForm
示例#1
0
 ?>
                 <section class="col-md-12">
                     <div class="row">
                         <section class="col-md-4" style="padding-right:0px;width:36%!important;">
                             <?php 
 echo $form->textFieldGroup($CalculatorForm, 'average_fuel');
 ?>
                         </section>
                         <section class="col-md-5" style="padding-right:8px;padding-left:13px;width:40%!important;">
                             <?php 
 echo $form->textFieldGroup($CalculatorForm, 'fuel_price');
 ?>
                         </section>
                         <section class="col-md-3" style="padding-left:5px;width:24%!important;">
                             <?php 
 echo $form->dropDownListGroup($CalculatorForm, 'currency', ['widgetOptions' => ['data' => CalculatorForm::getCurrency()]]);
 ?>
                         </section>
                     </div>
                     <div class="row">
                         <section class="col-md-12">
                         <?php 
 $this->widget('bootstrap.widgets.TbButton', ['url' => '', 'buttonType' => 'link', 'label' => Yii::t('CargoModule.default', 'Расчитать себестоимость'), 'htmlOptions' => ['id' => 'count']]);
 ?>
                         </section>
                     </div>
                     <div class="row count-result">
                         <section class="col-md-6">
                             <div class="form-group">
                                 <label class="control-label"><?php 
 echo Yii::t('CargoModule.default', 'Требуется топлива');
示例#2
0
        }
        // If we're here, then the custom Form validation rule validated properly
        return true;
    }
    // Perform the necessary operations on the operands, and output the value to the lblResult
    protected function btnCalculate_Click($strFormId, $strControlId, $strParameter)
    {
        switch ($this->lstOperation->SelectedValue) {
            case 'add':
                $mixResult = $this->txtValue1->Text + $this->txtValue2->Text;
                break;
            case 'subtract':
                $mixResult = $this->txtValue1->Text - $this->txtValue2->Text;
                break;
            case 'multiply':
                $mixResult = $this->txtValue1->Text * $this->txtValue2->Text;
                break;
            case 'divide':
                $mixResult = $this->txtValue1->Text / $this->txtValue2->Text;
                break;
            default:
                throw new Exception('Invalid Action');
        }
        if (isset($mixResult)) {
            $this->lblResult->Text = '<b>Your Result:</b> ' . $mixResult;
        }
    }
}
// And now run our defined form
CalculatorForm::Run('CalculatorForm');
示例#3
0
 /**
  * @var array $items
  * @return CalculatorForm
  */
 public function createCalculatorForm($items)
 {
     $form = new CalculatorForm();
     $form->build($items);
     return $form;
 }