Input

Skip to end of metadata
Go to start of metadata

Configuration

Name
Type
Description
width
integer
Length of the input in editmode (in pixels)
htmlspecialchars
boolean
Set to false to get the raw value without HTML special chars like & (default to true)
autoStyle
bool set to false to disable the auto-styling feature (gets the styles from the parent element and applies them to the input field) (since 1.4.6)

Additionally you can use every configuration property of Ext.form.TextField to customize the date widget in editmode.

Accessable properties

Name
Type
Description
text
string
Value of the input, this is useful to get the value even in editmode

Example

// Basic usage
<?php echo $this->input("headline"); ?>

//Advanced usage
<?php echo $this->input("headline", array("width" => 540)); ?>

Validation

It's possible to validate the input using one of the inbuilt Ext.form.VTypes ('alpha', 'alphanum', 'email' or 'url') or by making your own

//basic in-built validation
<?php echo $this->input("headline", array("vtype"=>"alphanum")); ?>

//advanced usage
<?php if($this->editmode): ?>
<script type="text/javascript">
    $(function(){
        
        // must return true or false
        Ext.apply(Ext.form.VTypes, {
          starts_with_number: function(val, field){     
            if(val.match(/\d.*/)){      
              return true;    
            }else{      
              return false;    
            }  
          },
          starts_with_numberText: "This field should start with a number"
        });
    });

</script>
<?php endif ?>

<?php echo $this->input("headline", array("vtype"=>"starts_with_number", "vtypeText"=>"This field is invalid")); ?>


From version 1.4.2 it is possible to pass a callback into the input options using Zend_Json_Expr

<?php 
// function must return true or an error message
echo $this->input("headline", array("width" => 540, 
  "validator" => new Zend_Json_Expr('
    function(value){
      if(value.match(/\d.*/))
      { 
        return true; 
      }
      elsereturn "This field should start with a number"; }
      }')
  )); ?>

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.