drupal Webform select list empty first value - select

I need for my select lists to have a default option of an empty value, or "Select" with no value.
I don't see any mention of how to do this in the documentation.
// $Id: webform.module,v 1.196.2.47 2010/08/16 17:54:19 quicksketch Exp $

You can add the patch webform_select_none_0.patch as mentioned in http://drupal.org/node/563170. Or if you do not have any experience with patches, you can add the following code to the _webform_render_select function in /sites/all/modules/webform/components/select.inc (of course taking into account any disadvantages of manually editing code)
if ($component['extra']['aslist'] && !$component['extra']['multiple'] && ($default_value === '' || !$component['mandatory'])) {
$element['#empty_value'] = '';
}
This will add the - Select - option to mandatory webform select fields when no option is selected

On the webform controls tab (node/%/edit/components/%), all you need to do is uncheck the "Mandatory" checkbox under "Advanced Settings".

Create a custom module and use form alter to modify the output. Explained here: https://www.drupal.org/node/1331956#comment-5876808

I believe you can achieve this with an empty entry in your option list:
|--Choose one--
val1|Value 1
val2|Value 2
val3|Value 3
etcetera.
However, I can't seem to find any sources on this at the moment. Good luck!

Related

Remove "empty" selection from dropdown list box

When creating a form in Orbeon Form Builder, you can define a list of values for a dropdown list box.
When running the form in form runner, is it possible to remove the "[Select...]" value from this dropdown list box?
I would like to restrict the possible values only to the given ones and restricting the user from selecting an "[Select...]" value when filling in the form. I hope you understand what I mean :)
Here is a screenshot
It's not possible without changes to Orbeon Forms to remove the empty option.
The best way to achieve what you want is to make the field required. When that's the case, the user will have to select a value or validation won't pass.
(The rationale for adding/keeping an empty option at the top is to force the user to make a selection. Otherwise it is possible that users might not even look at the option selected by default, and involuntarily select an incorrect option.)

Preselecting Options not working in web2py

I have looked at the documentation at http://www.web2py.com/books/default/chapter/29/05/the-views?search=OPTION%28 and I have looked at the previous question How to preselect options in SELECT helper in web2py, but my selects have not been working properly.
I make the select:
select = SELECT(_name = attr)
I populate it by appending options in a loop
...
option = OPTION(the_string, _value=str(row.id))
select.append(option)
...
I set the selected value for the select
select.value = str(selected_value)
But the select does not have anything pre-selected. In the html, the correct option is not marked 'selected'. What am I missing?
value is an argument of SELECT.__init__ -- it is not an attribute that can simply be set after the object is created. If you want to change the selected attribute of an option after it has been created, you can do:
select.element('option[value=%s]' %
str(selected_value))['_selected'] = str(selected_value)
Or just specify the selected option when creating the OPTION object:
OPTION(the_string, _value=row.id, _selected=True)

SimpleForm select to not include a blank (by default)

To have a select box omit the blank option you can do:
:include_blank => false
In Formtastic, there's a config option that allows you to do this by default:
Formtastic::FormBuilder.include_blank_for_select_by_default = false
Is the a way to configure this in SimpleForm too? I haven't been able to find it in the docs or anything...
Sorry but you can't do this with Simple Form right now. There was a pull request adding this feature but it wasn't merged. If you want to add it to Simple Form pull request is more than welcome.

TYPO3 extension: how to find certain TS setting

I found in typo3 admin side(/typo3), you can have two ways to set up TS,
you can set up through template->root, I think TS here will affect the whole site.
you can set up through template->certain page, it will only affect this page.
So my question is:
If I want to find where(which page) has TS setting such as : code = LIST, how could I do?
Use Web > Template module it has tools, you can for an example use Template Analyzer for the search
Try querying the database in phpMyAdmin or similar. The following looks in Template Setup:
SELECT pid, config, constants
FROM sys_template
WHERE config LIKE '%code = LIST%'
Replace config with constants to look in Template Constants. pid is the page ID.
If it is not set in the TypoScript, it perhaps has been set in the plugin itself. Just check the plugin content element itself.
In the Template module, go to the page where the setting is in effect.
Use the TSOB (Typo Script Object Browser) to search for "list":
This must show you all TS for this page that contains "list".
If you don't see the setting you can run a cmd/ctrl-F Search over the entire results.
You would have to search for "[code] = LIST".
Which will lead you to the following entry:
Hovering over the label will produce the above tooltip. Copy the line number.
Now change to the Template Analyzer. Here, you can click through all cascading templates and search for the line number:
This is definitely the line that sets that value.
From the "Template hierarchy" tree you will easily find the template that contains the setting.

Creating Expandable Forms in Microsoft Access 2007

I need to gather some information from a Microsoft Access form and I need everything to be as organized as possible.
There are a lot of columns that can be filled out, but don't necessarily apply to everyone and I want to keep everything as clean as possible.
In a form, is there any way to have certain input boxes displayed only if the user says they have that information?
For example:
Do you have a dog? () yes (o) no
Do you have a dog? (o) yes () no.............Dog name: [_________________________]
The yes's/no's shouldn't be added to the database, but I can dump them somewhere if need be.
Thanks in advance!
Justian
P.S
I'd like to put this on SharePoint as well, so extra brownie points if you can run me through that as well real quick.
Thanks again!
The way I usually handle this is with an option group for the first question, and a disabled text box for the other information, inside the frame of the option group. In the AfterUpdate event of the option group, you set the enabled property of the textbox:
Me!txtDogName.Enabled = (Me!optHasADog = 1)
...assuming that the value of the YES choice is 1.
You'd likely want to set the default value of the option group to the NO choice, and then you'd have the name field disabled by default.
You would also need the OnCurrent event of your form to do the same thing as in the AfterUpdate event.