Quantcast
Viewing all articles
Browse latest Browse all 297255

Modify Forms API Widget

Hi,

I wrote an own modul, which include a form. The module includes a form like this:

<?php
function MYMODULE_form($form, &$form_state) {

$form['zipcodes'] = array(
      
'#weight'=> '-49',
      
'#type'=> 'select',
      
'#title'=> t('chose zipcode'),
     
'#multiple'=> '0',
      
'#options'=> array(
         
10001 => t('10001 - city A'),
     
10002 => t('10002 - city A district Z'),
         
10003 => t('10003 - city B'),
         
10014 => t('10014 - city C'),
       ),
   
'#default_value'=> 10003,
);

return
$form;
}
?>

Now I like to alter the widget of the field zipcodes ($form['zipcodes']). I like to alter the select-list widget in a autocomplete-textfield like jquery changes list in autocomplete-text or from this module autocomplete_widgets.

But I don't know how to use the field api in my module source code ... May you help me?

I dont know/understand how to alter the widgets in form and I need some tutorials/documentary ... I searched the hole last day in the internet, but it seems realy tricky how to alter form-widgets aka "make the drupal-form think the listfield is an autocomplete-textfield and the autocomplete-options are the list-options ...". But I think some documentary would be useful ...


Viewing all articles
Browse latest Browse all 297255

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>