drupal-6


DRUPAL6 FORM FAPI WITH DRUPAL_RENDER


i have a drupal form with a element defined like showed above:
'gender' => array(
'#attributes' => array(
'#default_value' => t('Your name'),
'#option' => $tab
'#maxlength' => 255,
'#required' => TRUE,
'#title' => t('gender'),
'#type' => 'select'
),
Where tab is defined by $tab = {'m','F','mf',fm'}.
And in template file, i ouptput the element by:
in source code i see :
the name of the element becomes genderXXXX where XXXX is a random number whenerver i reload the page.
CAn someone help
The format of your form element is not correct.
To define a select, '#options' must be an array, '#default_value' must be the key of your options, '#attributes' is used to define additional HTML attributes, '#maxlength' is used by textfield and password etc..
You'd better have a look at the api of form: http://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/6#select
Here is a simple example:
$tab = array('m', 'F', 'mf', 'fm');
$form['gender'] = array(
'#type' => 'select',
'#title' => t('gender'),
'#default_value' => 0, // default value will be m
'#options' => $tab,
'#size' => 255,
'#required' => TRUE,
'#attributes' => array('class' => 'gender_select')
);

Related Links

Drupal 6 listing taxonomy terms in views
Avoiding duplicates in drupal 6 views2-relationship-results
drupal6 hook_order($op, &$arg1, $arg2) the third argument is alway coming empty
drupal 6: write to 2 different tables for user account registration form
Drupal 6: How to use form_set_error on specific cell when using tablefield module
Multiple location in single GMAP
Drupal 6 site not displaying image links
How to display a calendar in Drupal?
Drupal 6 - Passing variable between functions specifically - Passing menu name to phptemplate_menu_item
What procedure does default form submit button handler follow?
wamp reinstall - how to replace new files with old files
URL based breadcrumbs display
How to remove the duplicate items from the Taxonomy terms view in Drupal-6?
Changing Drupal module template doesn't take effect
How to show list of custom objects in a page in Drupal
Some cck fields not turning into HTML

Categories

HOME
client
osgi
openmp
image-processing
drivers
smarty
layout
dot
routes
tizen-web-app
leon
wamp
onelogin
cross-validation
esper
python-unittest
node-pdfkit
reveal.js
floating-action-button
numeral.js
quicklook
google-static-maps
ab-testing
visual-composer
plunker
paging
intentfilter
mustache.php
lcd
xpages-ssjs
semantic-analysis
poltergeist
traffic
nhapi
filezilla
jspm
srcset
unboundid
binary-data
textmate
ghost4j
io-redirection
restlet
bitbucket-pipelines
libvpx
unspecified
xenforo
ws-security
nand2tetris
vao
checkboxlist
skeleton-css-boilerplate
smartcontracts
azure-application-gateway
aurelia-validation
pg-dump
sqlbulkcopy
nbconvert
root-framework
mikroc
storekit
blackberry-10
hover-over
ios4
wapiti
qtableview
ibaction
ios9.1
angular-local-storage
cdt
relocation
castle
has-many-through
typeof
monomac
intentservice
gridfs
shellexecute
typoscript2
frameset
wse3.0
dotnethighcharts
asyncfileupload
window-management
rfc1123
servicehost
recent-documents
locate
digest-authentication
gallio
iweb
boost-smart-ptr
yagni
thread-local-storage
gacutil
geneva-server
dbisam

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App