function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LakshmiGenLakshmiGen 

rerender pageblock buttons is not working

Hi,

 

I am not able to rerender my pageBlockButtons.Initially i will disable the button using apex variable on change of picklist in javascript iam calling action function and setting the value to false and rerenderin the pageblock button id.

 

It is not at all reflecting .I Apperciate your help.

 

below is my code

 

<apex:pageBlockButtons id="pageBlockButtons1" location="both" rendered="true">
<apex:actionRegion id="ButtonsRegion">
<apex:commandButton action="{!UpdatePriority}" disabled="{!submitflag}" id="SubmitButton" value="Update" rendered="true"/>
</apex:actionRegion>
</apex:pageBlockButtons>

 

<apex:pageBlockSection title="{!$Label.Update_Priority_Duedate}" id="EditPriorfieldsPB" collapsible="true" rendered="true">
<apex:repeat id="repeat1" value="{!$ObjectType.temp__c.FieldSets.EditPriority}" var="stdR0">
  <apex:inputfield id="userval" value="{!con[stdR0]}" required="{!OR(stdR0.required, stdR0.dbrequired)}" onChange="DateValidation(this.value,'{!stdR0.fieldPath}');" rendered="true"/>
  </apex:repeat>
</apex:pageBlockSection>

 

<apex:actionFunction name="jsDateValidation" action="{!actionFunDateValidations}" rerender="pageBlockButtons1" immediate="true">
 <apex:param assignTo="{!dateDetails}" value="" id="DateDetails" name="dateVal"/>
</apex:actionFunction>

 

 

 

jiah.choudharyjiah.choudhary

@LakshmiGen,

 

I would suggest you to try following :

 

1. Add the pageBlockButtons in an outputPanel and add id to that panel and rerender that.

 

OR (If this doesnt work)

 

2. Remove actionRegion and repeat (1).

 

LakshmiGenLakshmiGen

Hi jiah.choudhary

 

Thanks for your sugestion

 

1)Add the pageBlockButtons in an outputPanel and add id to that panel and rerender that.
The above one is working but only the top button is enabling.


Here I cannot remove the apex repeat as I need to populate list values using apex repeat.
I have removed action region as you suggested.

 

Please suggest any idea...

Thanks,

Lakshmi Pandeela.

jiah.choudharyjiah.choudhary
@LakshmiGen,

Do you need the rendered="true" in your pageBlockButtons tag? I think this is the issue. Since the id wont be rendered if there is rendered attribute on the tag. you can try this by removing rendered for a while and then rerendering the pageBlockButtons.
LakshmiGenLakshmiGen

Hi jiah.choudhary

i have remove rendered tag and implemented your sugesstion but still the same issue

below is the updated code

 

<apex:pageBlockButtons id="pageBlockButtons1" location="both" >
<apex:outputPanel id="buttonpanel">
<apex:commandButton action="{!UpdatePriority}"    disabled="{!submitflag}" id="SubmitButton" value="Update" />
 </apex:outputPanel>
</apex:pageBlockButtons>

<apex:actionFunction name="jsDateValidation" action="{!actionFunDateValidations}" rerender="buttonpanel" immediate="true">
 <apex:param assignTo="{!dateDetails}" value="" id="DateDetails" name="dateVal"/>
</apex:actionFunction>


<apex:pageBlockSection title="{!$Label.Update_Priority_Duedate}" id="EditPriorfieldsPB" collapsible="true" rendered="true">
<apex:repeat id="repeat1" value="{!$ObjectType.temp.FieldSets.EditPriority}" var="stdR0">
  <apex:inputfield id="userval" value="{!t[stdR0]}" required="{!OR(stdR0.required, stdR0.dbrequired)}" onChange="DateValidation(this.value,'{!stdR0.fieldPath}');" rendered="true"/>
  </apex:repeat>
</apex:pageBlockSection>

 

Thanks,

Lakshmi .

jiah.choudharyjiah.choudhary

@LakshmiGen,

 

1. Either put outpuPanel outside pageBlockButtons tag and rerender that outputPanel

 

OR

 

2. Rerender pageBlockButtons(not outputPanel) after removing rendered attribute (currently you have removed rendered but rerendering outputPanel)

LakshmiGenLakshmiGen

Hi Jiha,

 

1. Either put outpuPanel outside pageBlockButtons tag and rerender that outputPanel

 

it will not allow us to put output pannel below the pageblock buttons.it give error saying pageblock button should be under parent tag page block.

 

 

 

2.Rerender pageBlockButtons(not outputPanel) after removing rendered attribute (currently you have removed rendered but rerendering outputPanel)

 

when iam doing the above it is not enabling now both top and bottom buttons. earlier it was enabling top button.

 

any alternative solution

 

or can i get  apex repaeat values and its ids of fields in  javascript

 

 

if yes what is the syntax . right now iam able to get the button id and disabling in javascript to take this effect iam rerendering but unable to get the valus which are in repeat tag.

 

 

document.getElementById('myPage:frm:MPB:pageBlockButtons1:SubmitButton').disabled this return my button id but how to get other field which are in rpeat tag..

 

georggeorg

I just tried with java script...please take a look at the following code..this may help.

 

<apex:page >
<script>
function hideElemnt(elmntid)
{
document.getElementById(elmntid).style.visibility="hidden";
}
</script>
<apex:form >
<apex:commandButton value="Save" id="saveButton"/>
<apex:commandButton value="Hide Save BTN" onclick="hideElemnt('{!$Component.saveButton}');" reRender="pgblk"/>
<apex:pageBlock id="pgblk" >

</apex:pageBlock>
</apex:form>
</apex:page>

 

Thanks,

George

Visit m blog here

LinThawLinThaw
Hi,

Please use actionSupport, it is working.
If there is anyway please let me share.
 
<apex:selectRadio value="{!selectedOption}">
    <apex:selectOptions value="{!Options}"/>
    <apex:actionSupport event="onchange" action="{!dummy}" reRender="searchButton"/>
</apex:selectRadio>

-----

<apex:pageBlockButtons location="bottom">
    <apex:outputPanel id="searchButton">
    	<apex:commandButton value="Search1" action="{!search1}" rendered="{!flag}"/>    
    	<apex:commandButton value="Search2" action="{!search2}" rendered="{!flag}"/> 
    </apex:outputPanel>                              
</apex:pageBlockButtons>

Regards,
LinThaw​