You need to sign in to do that
Don't have an account?
Michael Delucca
Declaring Get ; Set; Variable Issue
Hi All!
I am trying to retrieve input field values from a visualforce page and pass them into the pages controller -
I've declare the values on the top level of the controller: public string CreditCard {get; set;}
I then referenced them in the visualforce page: <apex:inputText label="Credit Card" value="{!CreditCard}" />
and then tried to pass them into the controller method: payment.fw1__Credit_Card_Number__c = CreditCard;
However, I get the following error:
"Error: PaymentResoCtrl Compile Error: Variable does not exist: CreditCard at line 149 column 46"
Aditionally, if I try to declare/instantiate the variable within the method as seen below, I get a null pointer error.
string CreditCard;
Can anyone help me figure this out? I'd really appreciate help and will definitely upvote any solution.
Thank you everyone! Have a great day!
I am trying to retrieve input field values from a visualforce page and pass them into the pages controller -
I've declare the values on the top level of the controller: public string CreditCard {get; set;}
I then referenced them in the visualforce page: <apex:inputText label="Credit Card" value="{!CreditCard}" />
and then tried to pass them into the controller method: payment.fw1__Credit_Card_Number__c = CreditCard;
However, I get the following error:
"Error: PaymentResoCtrl Compile Error: Variable does not exist: CreditCard at line 149 column 46"
Aditionally, if I try to declare/instantiate the variable within the method as seen below, I get a null pointer error.
string CreditCard;
Can anyone help me figure this out? I'd really appreciate help and will definitely upvote any solution.
Thank you everyone! Have a great day!
Can you share the entire code base so that we can help you troubleshoot and fix the issue?
E.g., let's say you are showing all the records from Credit_Card__c Obj who has Credit_Card_Name = 'Master'
first create a Apex Class and make a use of Set Method.
visualforce Page would look something like this:
How this works?
On visualforce page when you provide a value inside that text box let's say MASTER then that is thrown into that set method with the parameter of Str and so Str becomes MASTER. Then Keyword becomes MASTER. Why? Because out method says Keyword = Str;
Now, when you click Search button then {!showResults} controller gets called. Once that controller gets called, creditcardObj = [Select Id, Credit_Card_Name FROM Creit_Card__c WHERE Credit_Card_Name =:Keyword]; query gets run and creditcardObj gets returned via below method.
{
return creditcardObj;
}