View Full Version : Dropdown functionality on Web vs non-Web


08-05-2004, 08:51 PM
Using A5v6 I have a drop down box that receives its choices from a table called infolookup. It works fine without any hitches. I am now trying to replicate the table lookup in a dropdown box on an A5W page. The dropdown still works fine, however it defaults to the first value in my table rather than a blank as it does in native A5. Am I doing something wrong, or do I need to store a blank value in my infolookup table. If storing a blank value is the answer, how do I go about doing that?

Thanks in advance

Cheryl Lemire
08-05-2004, 09:15 PM
Below is the rest of the data from the version 6 board ... I have the code to set a default in the html, however, I am NOT familiar with the tools being used by Jim so I was unable to assist further. Hopefully somebody else has used the tools and knows where he needs to place this code:


To set a default value in a drop down list with a5w:

<option value="fiat" selected>Fiat

This and more helpful information can be found at:


Cheryl -

Under which specific dialog do I enter in the value, Drop Down Properties, than Choices? Than what?

Thanks in advance


Cheryl Lemire
08-07-2004, 07:29 AM
Hi Jim,

Since nobody else has replied to this post yet, may I suggest that you view the source code of your component and locate where the option values are set. Once you find this portion of the code you can add the 'selected' line to the code to show the default value that you desire.


Lenny Forziati
08-09-2004, 08:27 AM
Jim, what you are seeing is a differnece in the way HTML behaves compared to Alpha Five desktop forms. When you create a drop-down in HTML (which is what the components do for you), unless you explicitely define a default value, your browser will always select the first value as the default.

If you want the default to be blank, simply add a blank choice to your drop-down.


08-09-2004, 09:59 AM
Thanks Lenny, That is what I am trying to do, I created a blank in the choices dialog, however, it doesn't appear when its published.

Any thoughts as to why?

Howard G. Cornett
08-12-2004, 09:03 AM
How can you set this conditionally based on a session variable. In other words, depending on the value of a session variable, I want the default drop down value to be different. I tried entering A5 code in the HTML tab while editing the grid component, but the change does not stick when I force a save. And I don't see where such code would be entered in the Xbasic tab. Any help is much appreciated.


Lenny Forziati
08-12-2004, 10:17 AM
Yes Jim, Selwyn and I actually noticed this problem in your app that you sent to him last night. The blank choice that you are putting in is correct. It is a bug that it is being removed and we are fixing it.


Pat Bremkamp
10-30-2004, 10:01 AM
Was a solution to this problem ever found?

In some cases, such as Salutation, adding a blank record to the table works fine and the default value of blank works correctly.

However, in other cases, I'm at a loss. For example, I have a filtered list of names to fill in a field in a grid. If the user has picked a name to fill the field, then fine, but if the user has not picked a name, then the first value appears and looks to the user as if it has been selected... not what I want.

Adding a blank record for every possible filter is also difficult, since a user doing cleanup will likely start deleting those blank values.

I tried figuring out an "in line style", but couldn't, and tried to put in a conditional statement in the "display" row of the choices dialog box that says if the value of the field is blank, display blank, otherwise display the dropdown, but the table fields are not available, only the fields in the dropdown table.

Anyone have a slick solution?


10-30-2004, 12:17 PM
Was a solution found? Hard to say. When one of the patches came out the problem appeard to be fixed. THan another patch came out and the problem reappeared (at least in my apps). I solved the problem by putting a blank record in. I know thats not what you want to hear.

10-30-2004, 02:44 PM
I just built a grid component using the Alpha Sports invoice header table. I created a dropdown to get a customer id and populated the drop down dynamically from the customer table. On a new record, the drop down was initially blank, and the first option was blank. There are no blank records in the table. On an existing record, there was no blank option. Do you want a blank option to show for an existing record?


10-30-2004, 03:45 PM
What I am doing is this: I have a field that is looking up its data from a table. The field is not mandatory, thus if nothing is selected I want it to appear as blank. If I do not have a blank record in the lookup table, the initial choice is the first record in table

10-30-2004, 04:13 PM
In other words, you want a blank choice for an existing records.

Attached is a zip file with a component and an a5w page using the component. These were built in Alphasports. The component was created with a static dropdown. Then on the page, the choices property was overridden and replaced by a list generated with a single blank choice and table.external_record_content_get() to fill in the values from the customer table. This will give a blank choice for an existing record without having a blank record in the lookup table.

There are other ways to do this, but it would be nice to have the option for a blank choice in the component.


10-30-2004, 06:19 PM
Thanks Jerry -

I'll check it out on Monday

11-01-2004, 09:50 AM
Jerry -

I loaded the component and page, I was able to see that it is showing up with blanks, but I can't see where choices property was overridden. When I open the properties, it appears as "static", when I look at the A5W page I don't see the code "table.external_record_content_get()"

Am I doing something wrong or looking in the wrong place?


11-01-2004, 04:21 PM

The override code is the first code section on the a5w page just above the "compute the HTML for the Component" section. It is duplicated below.

choices = " | "+crlf()+table.external_record_content_get("customer","alltrim(lastname)+\", \"+alltrim(firstname)+\"|\"+customer_id","lastname")

tmpl_DropdownTest.field_info[1].DropdownBox.Choices = choices

In this example, I am showing the lastname, firstname but saving the customer_id.