Help

2

how to remove first empty element from fields.selection

Avatar
priyankahdp

need to remove first empty element from selection drop down list.and one is selected default.please advice me to do that friends..

selection field

its comes like

Gender
-----------------------------
|                         |v|
-----------------------------
EMPTY ELEMENT
-----------------------------
Male
-----------------------------
Female
-----------------------------
Avatar
Discard
2 Answers
5
Best Answer

The "empty element" gives you the opportunity to leave the field empty. If you need to insert a default value in the field you can use:

_defaluts = {
  'field_name' : 'default_value',
}

or you can set the field as required so the user are forced to select a voice in the selection to save the recvord.

5 Comments
Avatar
Discard
Avatar
priyankahdp
-

thanks Francesco . :-)

Avatar
Vaibhav
-

Thanks Its working :)

Avatar
Prakash
-

I used default value. Its working fine form loading with default value but in the drop down empty options also shown. How to remove empty options completely and in the selection shows only two options. (male, female) Thanks for your help

Avatar
Rui Andrada
-

As Prakash says, the default not removes empty option from selection field. I think this answer not resolve the question asked. I think the empty option should be removed after user selects as required field, but is not happens yet.

Great.

0
Best Answer

Or we can make this field required to remove the blank value

with required="1"

Avatar
Discard