I have a text field and a ajaxified
link in my form:
$form['id_number'] = array(
'#title' => t('ID Number'),
'#type' => 'textfield', //textfield
'#suffix' => '<div>l(t('101-03043'), 'myid_choose_result/101-03043/1, array('attributes' => array('class' => 'use-ajax')))</div>', //ajaxified link
'#attributes' => array('id' => 'myid_search_id_number'),
);
The link above calls a function myid_choose_result
define in my hook menu:
function myid_menu(){
$items = array();
$items['myid_choose_result'] = array(
'page callback' => 'myid_choose_result',
'access callback' => 'myid_user_access',
'file' => 'myid.pages.inc',
'type' => MENU_CALLBACK,
);
return $items;
}
What I want to achieve is every time the user clicks the link, the text field value will be the link’s text. After doing so, I want to call a another function:
function myid_choose_result($id,$template){
//Change the textfield's value into $id
myid_some_function(); //Call another function
}
How will I do that?