• #15760
    Salesforce | Jyoti Jyoti #470
    Forcetalks

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

    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;

    }

     

     

    #18670
    Salesforce | Manpreet Manpreet #51
    Forcetalks

    Hi Jyoti,

    try something like this-

    VISUALFORCE PAGE :

    1

     

    APEX CONTROLLER2

    Thanks.

Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?