You need to sign in to do that
Don't have an account?
SelectList does not rerender
Hi,
I have a visualforce page and a controller
in the visualforce page i have some inputfields and a selectlist an an datatable with some records if we click on a record in the datatable the inputfields are populated with the data from the datatable. Now the problem is that the selectlist gets only populated ones, the second time the value does not change.
example:
selectlist with salutation
<apex:selectList id="contactSalutation" value="{!salutation}" size="1" >
<apex:selectOption itemValue="" itemLabel="Choose Salutation"/>
<apex:selectOption itemValue="DHR" itemLabel="DHR"/>
<apex:selectOption itemValue="FR" itemLabel="FR"/>
<apex:selectOption itemValue="HR" itemLabel="HR"/>
<apex:selectOption itemValue="HRN" itemLabel="HRN"/>
<apex:selectOption itemValue="M" itemLabel="M"/>
<apex:selectOption itemValue="MEV" itemLabel="MEV"/>
<apex:selectOption itemValue="MME" itemLabel="MME"/>
<apex:selectOption itemValue="MR" itemLabel="MR"/>
<apex:selectOption itemValue="MRS" itemLabel="MRS"/>
<apex:selectOption itemValue="MS" itemLabel="MS"/>
</apex:selectList>
if i click in the datatable on a record that has a salutation of MR then the selectlist changes to MR, if i then click in the datatable on a record with salutation MRS the selectlist keeps standing on the MR.
So i think the selectlist does not rerender correctly.
Has anybody any idea on how to resolve this issue.
Thanks for the help
Sven
I have a visualforce page and a controller
in the visualforce page i have some inputfields and a selectlist an an datatable with some records if we click on a record in the datatable the inputfields are populated with the data from the datatable. Now the problem is that the selectlist gets only populated ones, the second time the value does not change.
example:
selectlist with salutation
<apex:selectList id="contactSalutation" value="{!salutation}" size="1" >
<apex:selectOption itemValue="" itemLabel="Choose Salutation"/>
<apex:selectOption itemValue="DHR" itemLabel="DHR"/>
<apex:selectOption itemValue="FR" itemLabel="FR"/>
<apex:selectOption itemValue="HR" itemLabel="HR"/>
<apex:selectOption itemValue="HRN" itemLabel="HRN"/>
<apex:selectOption itemValue="M" itemLabel="M"/>
<apex:selectOption itemValue="MEV" itemLabel="MEV"/>
<apex:selectOption itemValue="MME" itemLabel="MME"/>
<apex:selectOption itemValue="MR" itemLabel="MR"/>
<apex:selectOption itemValue="MRS" itemLabel="MRS"/>
<apex:selectOption itemValue="MS" itemLabel="MS"/>
</apex:selectList>
if i click in the datatable on a record that has a salutation of MR then the selectlist changes to MR, if i then click in the datatable on a record with salutation MRS the selectlist keeps standing on the MR.
So i think the selectlist does not rerender correctly.
Has anybody any idea on how to resolve this issue.
Thanks for the help
Sven
There are some languages that, when comparing strings, go only to the length of the shortest string. I don't know if that's the case here or not.
But if it is the case then it means that "MR" and "MRS" are the same, and so it doesn't have to change it.
The easiest resolution would probably be to add a space to the shorter labels so that "M" would be "M " and "MR" would be "MR ".
I hope this works for you.
Paul
Thanks for your reply, i did not know that
i will try this out and give you a reply back
thx
Sven
I tested it out and that is not the case in my situation.
If i change the selectlist to an outputfield than the value does change so it is really an issue with the selectlist rather than string comparissons
thx for the reply tho
Sven
In reading what I suggested I realize that I could have been more specific about where this is used.
Your code has:
<apex:selectOption itemValue="M" itemLabel="M"/>
<apex:selectOption itemValue="MEV" itemLabel="MEV"/>
<apex:selectOption itemValue="MME" itemLabel="MME"/>
<apex:selectOption itemValue="MR" itemLabel="MR"/>
<apex:selectOption itemValue="MRS" itemLabel="MRS"/>
<apex:selectOption itemValue="MS" itemLabel="MS"/>
and I'd suggest changing that to:
<apex:selectOption itemValue="M " itemLabel="M "/>
<apex:selectOption itemValue="MEV" itemLabel="MEV"/>
<apex:selectOption itemValue="MME" itemLabel="MME"/>
<apex:selectOption itemValue="MR " itemLabel="MR "/>
<apex:selectOption itemValue="MRS" itemLabel="MRS"/>
<apex:selectOption itemValue="MS " itemLabel="MS "/>
In this way the value of the field, from this input, is padded to make all of the strings distinct.
Paul