Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
mint

Validation Of Chtm Text Field

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...