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

How to display some results from an external database in a drupal node?
need to pipe between menu items in drupal (non-css)
Drupal multisite setup
transferring drupal site from localhost to live server
drupal 6 : node.tpl.php $links variable, where to configure the content?
Drupal: Create menu item for a view
How to render block programmatically with standard theme
Login to drupal
Apache Solr search index problem
drupal database backup [closed]
Drupal url alias and views and clear urls for taxonomy issues
Drupal 6: How do you print Taxonomy Terms as a CSS Body Class?
Drupal cck checkbox with global setting
How to update Customer Information messages in Drupal :: Ubercart
Hide username and date in Drupal page
How to add custom blocks in drupal?

Categories

HOME
java
sendgrid
multithreading
deezer
path-finding
nullpointerexception
analysis
v8
survey
echarts
node-notifier
elasticsearch-hadoop
user-input
spring-xd
handsontable
u-sql
google-apps-marketplace
windows-azure-storage
visual-studio-2005
circuit
database-replication
excel-vba-mac
shared-hosting
paging
xlsxwriter
excel-2007
dxf
one-to-many
bootstrap-material-design
fgetcsv
dbclient
ioio
hybridauth
azure-sql-database
gammu
http-referer
main
space-complexity
hot-module-replacement
service-discovery
bootstrapper
s
scorm
network-flow
logparser
ionicons
powercli
forever
slickedit
namecoin
mediaelement
cubes
slicknav
skobbler-maps
django-debug-toolbar
player
contact-list
moveit
apachebench
jms2
comobject
coveralls
census
remobjects
angular-local-storage
key-management
system.reflection
tt-news
issuu
ember-charts
openlaszlo
jsctypes
dotnetnuke-5
jquery-mobile-dialog
flashvars
android-hardware
gil
nsnetservice
asyncfileupload
ecl
remember-me
google-friend-connect
gamma
suppress
mirah
perfect-hash
firefox-5
uimenucontroller

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App