function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SATZSATZ 

Getting user input

Hi.

  I am creating custom login page .When user enters the value that is saved in Account object. there is two field for saving user name and password.

  

 In the login page user enter the user name and password . That is already saved in account. Based on that we checking availability of user name and password in account and doing further action.

    

    how to save the user inputs in apex variable in controller .

My code is

 

page:

----------

<apex:page showHeader="false" sidebar="false" controller="login">
<apex:form >
    <br><apex:image value="{!$Resource.AnimFlag}" width="100" height="100"/></br>
        <apex:pageBlock >
        <apex:pageBlockSection title="Account New">
              <br>User Name<apex:inputText value="{!passValue}"/></br>
              <br>PassWord<apex:inputSecret value="{!passValue1}" /> </br>
              <apex:commandButton value="Submit" onclick="{!login}"/>
              <apex:outputLink >   ForgetPassword </apex:outputLink>
              <apex:outputLink value="https://packagetesting.ap1.visual.force.com/apex/AccountDisplay">   Create new Account</apex:outputLink>
        </apex:pageBlockSection>      
        </apex:pageBlock>     
    
</apex:form>
</apex:page>

 

 

controller

-------------

public with sharing class login{

    public String passValue{get;set;}
    public String passValue1{get;set;}
    

    public String getLogin(){
List<Account> a = [select id from Account where Name='{!passValue}' and                           PackageTesting__Password__c='{!passValue1}'];
       

if(a.isEmpty()){
           // some logic goes here.
        }
        else{
        // some logic goes here.
        }
        return null;
    }
}

 

give me any suggestion

Thanks & regards

sathish

Jerun JoseJerun Jose
You will need a commandbutton or a commandlink to capture the data from the view state and pass them to the apex variables. Try this.
Create a command button and make it call a function in your controller. Inside that controller you will be able to see the values for the form elements set to the values from the page.