Hello,
I have an issue with the select box.
Although it is easy to set up, I have the list showing the "last" selection rather than the first...
It is ascending, and I have the initial drop down entry to "Please Select"... but it shows the last selection in the box when the user enters the page. I want it to be "Please Select" (initial drop down entry).
How do I enforce it to show the top of the drop down instead of the bottom?
Thank you all!
I have an issue with the select box.
Although it is easy to set up, I have the list showing the "last" selection rather than the first...
It is ascending, and I have the initial drop down entry to "Please Select"... but it shows the last selection in the box when the user enters the page. I want it to be "Please Select" (initial drop down entry).
How do I enforce it to show the top of the drop down instead of the bottom?
Thank you all!
RE: Select Box Drop Down (Dynamic) - Top selection not showing
Each select box should show the top entry by default, which in your case should be the 'Please Select' value.
As this is not happening, then it must be matching the "current value" of the control with one of the other options and so selecting that instead.
The current value is determined from the Field Value binding specified for the control, or if this doesn't match anything, the default value specified on the Field details page will be used.
I would check both of these areas to make sure they are not supplying a value which is causing the last entry to be selected.
If you are still having problems let me know and we can investigate further.
RE: Select Box Drop Down (Dynamic) - Top selection not showing
But If I can explain,
It seems that even if I just go ahead and create my first page, just pulling the drop down dynamically without trying to influence the results, it still displays the last of the list as default.
It happens all the time for me...
RE: Select Box Drop Down (Dynamic) - Top selection not showing
When a select control is displayed, the following steps determine which option is selected:
The Field Value binding is evaluated to see if it matches any elements. If so then the text value of the first matched element is taken.
If it doesn't match (or the value is blank) then the default value for the field (if provided) is taken.
This value is then compared against the data values for each select option to see which option should be selected.
If there is no match then the first option will be shown, which will be the initial dropdown value if one has been provided.
I hope this makes more sense!
If you are not seeing this behaviour, can you clarify a few points?
Is your control using a static or dynamic list of options?
Does each option have a distinct data value?
Is a field binding XPath specified, and does it match a value in the data?
Have you entered a default value?
Have you got multiple selection enabled?
Are you seeing the same behaviour on the preview and the deployed application?
If you are still having problems, we might need to see an export of your project to try and diagnose this further!
Regards,
Gerard
RE: Select Box Drop Down (Dynamic) - Top selection not showing
yes they are distinct.
yes there is a valid binding.
I have not entered a default value, but I did try the Initial drop down entry (for the Please Select)
I do not have the multiple selection enabled...
I am seeing the behaviour when I deploy and test
It isn't just this project,
it is every time I create a selection box and bind to my database... in any webmaker project.
Am I doing something wrong? I thought I read everything but... hey... I might actually have missed something!
I sure Appreciate the time you are spending to help me. :)
RE: Select Box Drop Down (Dynamic) - Top selection not showing
Did you manage to resolve this?
Have a look at the Data Bindings tab. Within here, have a look at the Page Display Bindings.
When you click onto the Select Box Options Location you should see the dropdown elements highlighted on the binding document on the right.
When you click onto the Select Box Options Data Value you should see the dropdown element codes (server data values) representing the dropdown list highlighted on the binding document on the right.
When you click onto the Select Box Options Display Text you see the dropdown element display values (screen values) representing the dropdown list highlighted on the binding document on the right.
If you now make a note of your XPath in the Field Value and clear this item completely and generate and preview, what do you see as the selected value? Now re-enter the original XPath and generate and preview and see if this selection changes. The Field Value XPath matches an element in your runtime document (in your case your database results) and matches this value to the Select Box Options Data Value.
For example, if a binding document looks like the following:
<eForm xmlns="http://www.hyfinity.com/mvc" xmlns:mvc="http://www.hyfinity.com/mvc"> <Control> ... </Control> <Data> <formData> ... <selectedCode>3</selectedCode> </formData> <selectList> <item code="1">List Item 1</item> <item code="2">List Item 2</item> <item code="3">List Item 3</item> <item code="4">List Item 4</item> <item code="5">List Item 5</item> </selectList> </Data> </eForm
and the bindings are as follows:
Field Value = /mvc:eForm/mvc :D ata/mvc:formData/mvc :s electedCode
Select Box Options Location = /mvc:eForm/mvc :D ata/mvc :s electList/mvc:item
Select Box Options Data Value = @code
Select Box Options Display Text = .
When the Field Value is blank then you should see the Initial Drop down entry specified in the Field Details. If you hadn't specified an initial value then you should see the first item. List Item 1 in this example. If your Field Value XPath matches a data value (3 in this example) then you should see the selected item (List Item 3 in this example).
I suspect the structure of your data that is being displayed is probably not being returned as expected or the Field Value is matching something it shouldn't. You should be able to see the exact document being returned at runtime using the Test Dashboard.
I hope this helps.
Kind Regards
Abdul
RE: Select Box Drop Down (Dynamic) - Top selection not showing
I removed the value that was there and it works!!!!!
Thank you soooo much!!!!!!!
RE: Select Box Drop Down (Dynamic) - Top selection not showing
That's great. Please don't forget that this is only displaying your Initial Drop down entry as defined in the Field Details tab
When you have the need to preserve the selected list item between page invocations then you will need to populate the Field Value with an appropriate XPath as in my example above.
Regards
Abdul