Jump to content
Larry Ullman's Book Forums

Validation Of Chtm Text Field


mint
 Share

Recommended Posts

Is there any way to validate a normal chtml text field(Chtml::textField declared without any model class) and display a message on he same page if the user leaves it blank and clicks a submit button.

Here is the code

<?php
echo CHtml::beginForm(array('transaction/disp'),'Post'); ?>   
<div class="row">
   <?php echo CHtml::label('Transaction Status','trst'); ?>
</div>
<div class="row">
   <?php echo CHtml::textField('trst','',array('id'=>'trst','size'=>10)); ?>
</div>
   <?php echo CHtml::submitButton('Submit', array('id'=>'submit','name'=>'submit')); ?>
<?php echo CHtml::endForm(); ?>

Link to comment
Share on other sites

 Share

×
×
  • Create New...