Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Look & Feel  /  SetTabIndex

SetTabIndex
SetTabIndex (
mixed $tabs
)

Arguments:

Name Description
$tabs Array or comma seperated string with the field names. When an array is given the array index will set as tabindex.

Description:

With this function you can set the tabindexes of the field.
This function has one argument: $tabs.

You can set the tabindexes in two ways. You can give a string or an array as argument.
When you give a string as argument, the field names have to be comma seperated and in the right order.
When you give a array as argument, it has to contain the names of the fields (or buttons). The array keys are used as tab index.

Fields with negative tabindexes are not accessable with the tab key. Fields without tabindexes are accessable with the tab key after all the other fields.

Example

<?php

// include the class
include("FH3/class.FormHandler.php");

// create a new form
$form = new FormHandler();

// some fields + button
$form -> textField("Field 1""fld1");
$form -> textField("Field 2""fld2");
$form -> textField("Field 3""fld3");
$form -> submitButton("Submit""submitBtn");

// the tabs!
$tabs = array(
  
=> "fld1",
  
=> "fld2",
  
=> "fld3",
  
=> "submitBtn"
);

// set the tabs
$form -> setTabIndex($tabs);

/* // this is also correct!
* $form -> setTabIndex( "fld2, fld3, fld1, submitBtn" );
*/

// set the handler function
$form -> onCorrect("doRun");

// flush the form..
$form -> flush();

// data handler
function doRun$data 
{
    
// do something here...
}
?>


In the example above, a indexed array is used. You can also use an array like this:
<?php

// the tabs!
$tabs = array(
  
"fld2",
  
"fld3",
  
"fld1",
  
"submitBtn"
);

?>

Latest change: 05 March 10 / 08:46

Comments

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license