+ Start a Discussion
cnp_nareshcnp_naresh 

How to do rerender with dynamic vissualforce bindings

HI Friends,

 

    

<apex:repeat value="{!displayFields}" var="f">
                    <apex:inputfield value="{!acct[f]}" rendered="cond"/>
<apex:selectlist value="{!acct[f]}" rendered="cond" onchange="showstates('this.value')">
<apex:selectOptions value="{!showcountries}">

</apex:selectlist>
<apex:outputpanel id="staterefresh">
<apex:selectlist value="{!acct[f]}" rendered="cond">
<apex:selectOptions value="{!showStates}">
</apex:selectlist>
<apex:outputpanel>
                </apex:repeat>

 According to the country selected, I need to refresh the State values... But this is not at all happening in visualforce page. I am able to refresh the values according to the country selected but when I submit the form to save the record, I am getting error 'Mailing State/Province: Validation Error: Value is not valid'. 

 

Please help me.

 

Thanks,

Naresh B

Devendra@SFDCDevendra@SFDC

Hi,

 

In your code, you have not used rerender attribute anywhere.

 

You are using rendered attibute.

 

There is a difference between these two attributes.

 

Thanks,

Devendra

imutsavimutsav
In dynamic VF page Id are retrieved in sequence through Component.
Check this out
http://www.salesforce.com/us/developer/docs/pages/Content/pages_best_practices_accessing_id.htm

Thanks
Utsav

[Do mark this answer as solution if it works for you and give a kudos.]
cnp_nareshcnp_naresh

HI Devendra,

 

Thanks for your quick reply.

I am usring rerender atrribute throgh actionfunction tag.

<apex:actionFunction action="{!getshowStates}" name="StateData" reRender="staterefresh">
             <apex:param name="Statevalue"  value="" assignTo="{!PayeeCountry}" />
        </apex:actionFunction>


<apex:repeat value="{!displayFields}" var="f">
                    <apex:inputfield value="{!acct[f]}" rendered="cond"/>
<apex:selectlist value="{!acct[f]}" rendered="cond" onchange="showstates('this.value')">
<apex:selectOptions value="{!showcountries}">

</apex:selectlist>
<apex:outputpanel id="staterefresh">
<apex:selectlist value="{!acct[f]}" rendered="cond">
<apex:selectOptions value="{!showStates}">
</apex:selectlist>
<apex:outputpanel>
                </apex:repeat>

  According to the country selected, I need to refresh the State values... But this is not at all happening in visualforce page. I am able to refresh the values according to the country selected but when I submit the form to save the record, I am getting error 'Mailing State/Province: Validation Error: Value is not valid'.

 

Thanks