Perforce Chronicle 2012.2/486814
API Documentation
|
This is the basic search query form. More...
Public Member Functions | |
init () | |
Defines the elements that make up the seach form. |
This is the basic search query form.
Search_Form_Basic::init | ( | ) |
Defines the elements that make up the seach form.
Called automatically when the form object is created.
{ // disable CSRF protection as its not needed and also to exclude the token from the query $this->setCsrfProtection(false); // form should use p4cms-ui styles. $this->setAttrib('class', 'p4cms-ui search-form'); // add a field to collect the user's query. $this->addElement( 'text', 'query', array( 'label' => 'Search', 'filters' => array('StringTrim') ) ); // add the search button // beware - we set a ' name' attribute (notice the leading space) // to empty string so that this element isn't included in the request // params - this works because the space ensures attrib isn't mapped to // setName, but does make it into the form element at render time and // inputs with no name are not included in form submits. $this->addElement( 'SubmitButton', 'submit', array( 'label' => 'Search', 'required' => false, 'ignore' => true, 'class' => 'preferred', 'attribs' => array( ' name' => '' ) ) ); }