+ Start a Discussion
Scott BradyScott Brady 

Want to modify the existing on-click Java button to add a drop down picklist that based on selection, will modify the visible fields

I have this existing code
 
<apex:page standardController="BMCServiceDesk__Incident__c">

  <apex:sectionHeader title="SIEM - Account Event"/>
  <apex:form >
    <apex:pageBlock >
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Save & Send Email"
            action="{!save}"/>
        <apex:commandButton value="Cancel"
            action="{!cancel}"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection title="Account Event - Alarm Information"
          collapsible="false">
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Event_Action__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Alarm_Name__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Signature_ID__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Event_ID__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Source_IP__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Source_Port__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Host__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Destination_IP__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Destination_Port__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Source_User__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Modified_Object__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Modification__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Time_Date__c}"/>
        <apex:inputField value="{!BMCServiceDesk__Incident__c.Description__c}"/>        
      </apex:pageBlockSection>
     </apex:pageBlock>
  </apex:form>
</apex:page>

I wish to add additional functionality so that, after they click on the button to bring up the new page with fields to be filled out, I want them to have the option to select from a picklist of 3 options, which depending on the selection, will update the form to include either additional fields or remove fields.

So, in the example above, I want to add a field, we will call it Picklist__c for this exercise, and if they select Option 1 - then I want one set of fields to appear.  Option 2 - a different set of fields, etc.

The end goal is to remove the need to create multiple buttons.

Thanks,
Scott