Activity Forums Salesforce® Discussions Sample code for option button on VF page and getting value in apex class

  • Sample code for option button on VF page and getting value in apex class

    Posted by Jyoti on September 1, 2016 at 6:14 am

    Hi

    I need to built a page with say two or more fields - their values will be Yes or No - based on if it is selected or not.

    Get these field values in class and based on field values set variable values and call the function e.g:

    VF Page:

    Text1: Yes(it is a radio button)

    Text2: Yes(radio)

    call saveList from action button on VF page.

    Apex Class:

    Public String Cat

    Public String Req

    public PageReference saveList()
    {

    if(Text1 == Yes):

    Cat = 'abc'

    Req = 'abc'

    CallFunction(Cat,Req)

    }

    if(Text2 == 'Yes'){

    Cat = 'def'

    Req = 'def'

    CallFunction(Cat,Req)

    }

    }

    public void CallFuntion(String Cat, String Req)

    {

    statements;

    }

     

    Manpreet replied 7 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Manpreet

    Member
    March 27, 2017 at 11:28 am

    Hi Jyoti,

    try something like this-

    VISUALFORCE PAGE :

    1

     

    APEX CONTROLLER2

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos