+ Start a Discussion
Shrey TyagiShrey Tyagi 

Unable to Pass VF Page picklist value to apex method.

Hi All ,
  I have a section in vf pages that pass 2 values to apex method upon click of a link.

VF Page Code:

<table cellpadding="2" cellspacing="2">
    <tr>
       // //This value gets passed over as null 
        <td style="font-weight:bold;">Document Type<br/>
          <select id="DocTypeOnBase" value="{!searchDocType}">
            <option value=""></option>
            <apex:repeat value="{!DocTypeValues}" var="DocTypeValue">
              <option value="{!DocTypeValue}">{!DocTypeValue}</option>
            </apex:repeat>
          </select>
        </td>
      </tr>
    <tr>
       // //This value gets passed over successfully 
        <td style="font-weight:bold;">Document Text<br/><br></br>
        <apex:inputtext value="{!searchText}" id="DocumentText" rendered="true" />
        </td>
    </tr>
     <tr>
        <td><br/>
        <apex:commandlink action="{!processLinkClick}" target="_blank" ><b>Search OnBase</b></apex:commandlink>&nbsp;&nbsp;
        </td>      
      </tr>
   </table>


Apex Class:
 

public string searchText{get;set;}-- This one works
public string searchDocType{get;set;}-- This one passes null
public PageReference processLinkClick() {

      return new PageReference('https://onbasetest.rti.org/AppNet/docpop/docpop.aspclienttype=activex&cqid=196&fts='+searchText+searchDocType);
 }
DeveloperSudDeveloperSud
Hi ,

Try the below code , It is working for me. I am able to pass the selected picklist value to controller class but I did not check for the search Text as u mentioned it is working for you.
 
<apex:page controller="prac1">
<apex:form >

<table cellpadding="2" cellspacing="2">
<!--
    <tr>
        <td style="font-weight:bold;">Document Type<br/>
          <select id="DocTypeOnBase" value="{!searchDocType}">
            <option value=""></option>
            <apex:repeat value="{!DocTypeValues}" var="DocTypeValue">
              <option value="{!DocTypeValue}">{!DocTypeValue}</option>
            </apex:repeat>
          </select>
        </td>
      </tr>
      -->
      <apex:selectList size="1" id="pb1" value="{!selectedValue}" >
       <apex:selectOptions value="{!pickListValues}" />
      </apex:selectList>
    <tr>
      
        <td style="font-weight:bold;">Document Text<br/><br></br>
        <apex:inputtext value="{!searchText}" id="DocumentText" rendered="true" />
        </td>
    </tr>
     <tr>
        <td><br/>
        <apex:commandlink action="{!processLinkClick}" target="_blank" ><b>Search OnBase</b></apex:commandlink>&nbsp;&nbsp;
        </td>      
      </tr>
   </table>
   </apex:form>
</apex:page>
 
public with sharing class prac1 {

    
    
    public String DocTypeValues { get; set; }
    public string searchText{get;set;}
    public string searchDocType{get;set;}
    
    // new code added 
    public List<selectoption> pickListValues{get;set;}
    public String selectedValue { get; set; }

    public prac1(){
    pickListValues= new List<selectOption>();
    pickListValues.add(new selectoption('val1','Value1'));
    pickListValues.add(new selectoption('val2','Value2'));
    pickListValues.add(new selectoption('val3','Value3'));
    
    }
    
    
    public PageReference processLinkClick() {

      return new PageReference('https://onbasetest.rti.org/AppNet/docpop/docpop.aspclienttype=activex&cqid=196&fts='+selectedValue);
 }
    
  
   
   
}


 
Sam KharidiSam Kharidi
Hi folks,

I saw a few posts here where people are enquiring about integrating Salesforce and OnBase. We provide a pre-packaged solution to seamlessly integrate OnBase with Salesforce. This is built on the OnBase SDK and the force.com platform and allows users to view, link, archive, search AND exchange documents, forms, case objects and data between OnBase and ANY Salesforce object. Check us out if you're looking to solve this problem! 

https://www.mtssoftwaresolutions.com/resources/videos/maximize-salesforce-onbase-2019-08-29