Last active
August 29, 2015 14:24
-
-
Save vijaycs85/00171ad8b3ff233c8a1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// playground.module file. | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function playground_form_user_login_block_alter(&$form, &$form_state) { | |
$form['preference'] = array( | |
'#type' => 'select', | |
'#options' => array( | |
'test', | |
'test1', | |
'test2', | |
'test3', | |
), | |
'#multiple' => TRUE, | |
); | |
$form['#submit'][] = 'playground_form_user_login_block_sumbit'; | |
} | |
function playground_form_user_login_block_sumbit($form, &$form_state) { | |
print_r($form_state['values']);exit; | |
} | |
// After selecting first 3 option and submitting form will give: | |
Array | |
( | |
[name] => username | |
[pass] => password | |
[submit] => Log in | |
[form_build_id] => form-gwDOjVttTr6yEM1ZmNmUFmAPH3PO2MyFJ2O_c6SqUM0 | |
[form_id] => user_login_block | |
[preference] => Array | |
( | |
[0] => 0 | |
[1] => 1 | |
[2] => 2 | |
) | |
[op] => Log in | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment