You need to sign in to do that
Don't have an account?
Adelchi Pelizzo
Render pageblocksection using javascript funtion in Visualforce
I would like to show or hide different <apex:pageblocksection>'s depending if a checkbox is selected or not.
I am thinking to use <apex:actionSupport> to add a listener functionality to the <apex:inputfield> checkbox.
So when the box gets ticked the "onchange" attribute will trigger a java script:
<script type="text/javascript">;
function ShowSection() {
document.getElementById("pageid:formid:pageblockId").style.display ='block';
}
</script>
I have got stuck here, can anybody point me in the right direction please?
Thanks
I am thinking to use <apex:actionSupport> to add a listener functionality to the <apex:inputfield> checkbox.
So when the box gets ticked the "onchange" attribute will trigger a java script:
<script type="text/javascript">;
function ShowSection() {
document.getElementById("pageid:formid:pageblockId").style.display ='block';
}
</script>
I have got stuck here, can anybody point me in the right direction please?
Thanks
It worked, simply and effective!
I still have two question:
- How the "rendered" attribute works? Is it not supposed to take only boolean values?
- How to have the "reRender" action in <apex:pageBlockSection> to be assigned to multiple section ids?
Thanks again.
All Answers
For rendering section on the basis of checkbox value, you can simply put rendered condition on the page block section and rerender them accordingly. Here is a sample code:
Thanks,
Neetu
It worked, simply and effective!
I still have two question:
- How the "rendered" attribute works? Is it not supposed to take only boolean values?
- How to have the "reRender" action in <apex:pageBlockSection> to be assigned to multiple section ids?
Thanks again.