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
Jack Rose 1Jack Rose 1 

Rendering a field from a CommandButton action

Hi All, 

I'm not a developer, so apologises if I'm asking a silly question.
I am looking into some code that has been provided to us, for a visual force page using Bootstrap. We have created a web form using visual force. 

When the Reason for change field is selected, it opens up a dynamic list of fields, along with a submit button that creates a case (providing no validation rules have been triggered. I have added the continue button below. I'm wanting to control the rendering of the reason field with the button, e.g. the field is only displayed once the button is clicked. 

I have started to attempt this in the code but keep hitting errors. any suggestions would be appreciated. User-added image
User-added image
Jack Rose 1Jack Rose 1
better picture of the code
 User-added image
Suvankar Chakraborty 21Suvankar Chakraborty 21
Create a checkbox field. onclick of button the field will be checked.and check if the field will check that input field will be visible.
Follow this code :

function checkAll(ele) { var checkboxes = document.getElementsByClassName('sel'); if (ele.checked) { for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].type == 'checkbox') { checkboxes[i].checked = true; } } } else { for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].type == 'checkbox') { checkboxes[i].checked = false; } } } }
Put Reason for Change in <apex:outputPanel> and assign an id and rendered to a variable like this:
<apex:outputPanel id="myPanel" rendered="{!continue}">
---Reason for Change field---

Now, add an action to the Continue button to flip the value of variable "checkbox" to true and pass the id "myPanel" in rerender.
Jack Rose 1Jack Rose 1
Thank you for the advice. How do I create the action on the continue button?
Jack Rose 1Jack Rose 1
Also is it possible to run the validation rules against the visible fields before displaying the reason?