+ Start a Discussion
Nagarjuna Reddy NandireddyNagarjuna Reddy Nandireddy 

HOW TO PASS THE INPUTS BY USER IN APEX CLASS?

Hi all i am trying to pass the values by user defined in apex class but i am not getting........
In  c# values was passed like this: 
int A = parse.int(Console.ReadLine};
in Apex class i am not getting
will you please tell me how pass the values...

                                                                                                           need help....
                                                                                         NANDIREDDY NAGARJUNA REDDY  


 
Amit Chaudhary 8Amit Chaudhary 8
It look you are new developer in salesforce. I will recommend you to learn salesforce from trailhead.

Apex & .NET Basics
Discover similarities between programming in .NET and Apex, and learn the basics of starting with Apex.
1)https://developer.salesforce.com/trailhead/module/apex_basics_dotnet

Visualforce Basics
Use Visualforce to build custom user interfaces for mobile and web apps.
1) https://developer.salesforce.com/trailhead/module/visualforce_fundamentals

Let us know if this will help you

Thanks
Amit Chaudhary
 
Vivian Charlie 1208Vivian Charlie 1208

Hi Nagarjuna,

 

public with sharing class AccountController {
    public string strName {get;set;}
}

<apex:page controller="AccountController">
    <apex:form>
        <apex:inputText value="{!strName}"/>
    </apex:form>
</apex:page>

 

Apex and Visualforce use getter setter variables to exchange data between the View and the Controller.

 

Thanks

Vivian

Vivian Charlie 1208Vivian Charlie 1208
Now the <apex:iputText> tag  would create an input element on the page. Whatever value the user enters in the element would be binded with the controller and can be used when you create any other methods (eg. customSave(), custom Cancel() etc.) in AccountController class