You need to sign in to do that
Don't have an account?
Nicolás Kacowicz
Don't reload to top of the page
Hello everyone, I have a problem that it is driving me crazy. I have radio buttons on my Visualforce page, some of the radio buttons are hidden when you first open the page, but if let's say the radio button #10 is changed to the option 'Yes', I refresh the page and show 2 more radio buttons.
My problem is that it's always reloading the page to the top and I don't want it.
I have this radio buttons inside pageblock and outputpanel.
I was able to make it work to go to a button but not a radio button.
On Apex I have differents functions to each radio button that displays hidden radio buttons.
I called this function like this:
Thanks!
My problem is that it's always reloading the page to the top and I don't want it.
I have this radio buttons inside pageblock and outputpanel.
I was able to make it work to go to a button but not a radio button.
On Apex I have differents functions to each radio button that displays hidden radio buttons.
I called this function like this:
<apex:selectRadio value="{!contact.LivesInAmerica__c}" label="Do you live in America?" id="rb1"> <apex:selectoptions value="{!types}"></apex:selectoptions> <apex:actionSupport event="onchange" action="{!functionFirst}"/> </apex:selectRadio> <apex:selectRadio rendered="{!showRB1}" value="{!contact.Street__c}" label="Street"> <apex:selectoptions value="{!types}"></apex:selectoptions> </apex:selectRadio>And this code on Apex Class Controller:
public PageReference functionFirst(){ if(contact.LivesInAmerica__c == 'Yes'){ showRB1= true; } else { showRB1= false; } return null; }
Thanks!
All Answers
If you don't want to refresh the whole page then use reRender attribute. This attribute refreshes a particular section of VF page.
reRender="id" // here id is an identifier of a particular section in your VF Page which you want to refresh when a particular event occurs.
change your third line in VF Page with this below line--
<apex:actionSupport event="onchange" action="{!functionFirst}" reRender="rb1"/>
If this helps you marked this as solved.
I have the same problem as you had.
Could you eleborate some more about the solution you found?
Regards,
Jos