Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Add Values Of 2 Dropdown List And Textfield Together Display Result In Another Textfield

$
0
0
Hello,

I have two dropDownLists and a textfield.

I want the total sum of values of the two dropDownLists plus the textfield value and have them display the result in another textfield.

How would can i go about this. Below is a bit of the form i have created.

      <tr>
        <td><?php echo $form->labelEx($model,'typeofpaper'); ?></td>
        <td><?php $data = CHtml::listData(PaperType::model()->findAll(),'id','title'); 
                  if(isset($_REQUEST['id']))
                  {
                      $sel = $_REQUEST['id'];
                  } else {
                      $sel =''; 
                  }
                echo $form->dropDownList($model, 'typeofpaper', $data, array('prompt'=>'Type of Paper','options'=>array($sel=>array('selected'=>true)))); 
                
            ?>
            <?php echo $form->error($model,'typeofpaper'); ?></td>
      </tr>
      
       <tr>
        <td><?php echo $form->labelEx($model,'deadline'); ?></td>
             
        <td><?php 	echo $form->dropDownList($model,'deadline',
			
		  array('3hrs'=> '3 hrs', '6hrs'=>'6 hrs', '12hrs'=>'12 hrs', '24hrs'=>'1 day', '48hrs'=>'2 days', '72hrs'=>'3 days',
				'96hrs'=>'4 days', '120hrs'=>'5 days', '144hrs'=>'6 days', '168hrs'=>'7 days', '172hrs'=>'8 days', '196hrs'=>'9 days',
				'220hrs'=>'10 days', '244hrs'=>'11 days', '268hrs'=>'12 days', '292hrs'=>'13 days',	'316hrs'=>'14 days', '340hrs'=>'15 days'),array('empty' => 'Select Urgency Level')); ?>
            <?php echo $form->error($model,'deadline'); ?> </td>
      </tr>
      <tr>
        <td><?php echo $form->labelEx($model,'nopages'); ?></td>
        <td><?php echo $form->textField($model,'nopages'); ?>
            <?php echo $form->error($model,'nopages'); ?></td>
      </tr> 

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>