• Vinslikeu
  • NEWBIE
  • 5 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies

Hi,

Please help me in prompting error messages in below code.

1: for password field should be 6 digit numeric.

2: for Username or Password Is Incorrect..!!!

 

 

///////////////////////////Visualforce/////////////////////////

<apex:page controller="mylogin" sidebar="false">
    <apex:pageBlock title="UltraVoilet Account">
        <apex:pageBlockSection title="Login">
        <apex:form >
            <b>Username:</b> <br/>
            <apex:inputText required="true" id="username" value="{!userid}" /> <br/><br/>
            <b>Password:</b> <br/>
            <apex:inputSecret required="true" id="password" value="{!password}"/> <br/><br/>
            
            <apex:commandButton value="login" action="{!login}"/> <br/><br/>


            <apex:outputLink value="{!forgetpassword}">Forget Password?</apex:outputLink> <t/>

            
        </apex:form>
        </apex:pageBlockSection>
    </apex:pageBlock>

</apex:page>

 

 

 

 

//////////////////////////////Controller/////////////////////////////////////

public with sharing class mylogin {

    public String password { get
                                {if(password.length>=6)
                                    { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'password field should be 6 digit numeric..!!!'));
                                    }
                                } set; }
    public String userid { get; set; }
    public String forgetpassword { get; set; }
   
    public PageReference forgetpassword() {
        return null;
    }

    public PageReference login() {
        list<UV_Account__c> stdlist=[select id, Name, Username__c, Password__c from UV_Account__c where Username__c=:userid];
       PageReference reference;
       try{
       if(stdlist[0].Password__c==password)
        {
        reference=new PageReference('/apex/salesofficer');
        reference.setRedirect(true);
        
        }
        else ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Username or Password Is Incorrect..!!!'));
        }
        catch(Exception e){
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,'Exception - ' +e.getMessage());
            ApexPages.addMessage(msg);
            system.debug('------Exception caught----'+e);
        }
       
        return reference;
    }

    public String getUsername() {
        return null;
    }
    
}

I'm new on salesforce.

I'm trying to create dependent fields according to picklist value selection.

In the following code I want:

1: when I select "None" in picklist no field should display.

2: if I select 1st option in the picklist; only field1 should get display.

3: if I select 2nd option in the picklist; only field2 should get display.

3: and if I select 3rd option in the picklist; all the fields1,2&3 should get display.

 

Please Help me out of this task.. Thanks!

 

/////////////////////Visualforce///////////////////////

<apex:page controller="FieldSelection">
      <apex:pageBlock title="fields">
          <apex:form >
                <b>State:</b> <t/><t/>
                <apex:selectList id="sta" value="{!SelectedState}" size="1">
                    <apex:selectOptions value="{!StateList}" />
                </apex:selectList>
                <br/><br/>
                <b>Field1:</b><t/><t/>
                <apex:inputText required="true" id="city1" value="{!city1}" />
                <br/><br/>
                <b>Field2:</b><t/><t/>
                <apex:inputText required="true" id="city2" value="{!city2}" />
                <br/><br/>
                <b>Field3:</b><t/><t/>
                <apex:inputText required="true" id="city3" value="{!city3}" />
                
          </apex:form>
      </apex:pageBlock>
</apex:page>

 

 

 

/////////////////////////Controller/////////////////////////////////

public with sharing class FieldSelection {

    public String city3 { get; set; }

    public String city2 { get; set; }

    public String city1 { get; set; }

    public String SelectedState { get; set; }
    
    public list<SelectOption> StateList{
    get{
            list<SelectOption> st= new list<SelectOption>();
            st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select State__c from UV_Account__c];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.State__c) == FALSE){
               sNames.add(c.State__c);
               lFINAL.add(c);
        }
        }
            
            for( UV_Account__c fc : lFINAL)
            {
                st.add(new SelectOption(fc.id,fc.State__c));
            }
            return st;
       }
     set; }

}

Hi,

In the following code when i select picklist value in purchase order tab; page gets reload and switches to home tab.

Please help me to stay on the same tab.

 

 

///////////////////////Visualforce/////////////////////

<apex:tabPanel switchType="client" selectedTab="Home" id="SOTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">

<apex:tab label="Home" name="Home" id="tabHome">
<apex:form >
<apex:pageBlock title="Hello {!Name}!!! Welcome To UltraVoilet" >
</apex:pageBlock>
</apex:form>
</apex:tab>

 

<apex:tab label="Purchase Order" name="PO" id="tabPO">
<apex:form >
<apex:pageBlock title="Purchase Order Creation" mode="Edit" >
<apex:pageBlockSection title="Header" columns="4">
<b>State:</b>
<apex:selectList size="1" value="{!SelectedValue}">
<apex:selectOptions value="{!statusOptions}"/>
<apex:actionSupport event="onchange" action="{!checkValue}" />
</apex:selectList>
</apex:pageBlockSection>

</apex:pageBlock>

 </apex:form >

</apex:tab>

 

 

 

//////////////Controller///////////////
public string selectedValue { get;set; }
public List<SelectOption> statusOptions { get;set; }

public void autoRun()
{
Schema.DescribeFieldResult statusFieldDescription = UV_Account__c.State__c.getDescribe();
statusOptions = new list<SelectOption>();

for (Schema.Picklistentry picklistEntry : statusFieldDescription.getPicklistValues())
{
statusOptions.add(new SelectOption(pickListEntry.getValue(),pickListEntry.getLabel()));
}

}

public void checkValue()
{
System.debug('----------------'+selectedValue);
}

 

Dependent picklist values are not fetching.

 

How to make dependent field uneditable if parent field is not selected and if parent field is selected dependent field should show appropriate list values?

Please help me out from this.. Thanks!

 

///////////////////VF//////////////////////////////

              <apex:pageBlockSection title="Header" columns="4">
                <b>State:</b>
                <apex:selectList id="sta" value="{!SelectedState}" size="1">
                    <apex:selectOptions value="{!StateList}" />
                </apex:selectList>
                <!--  required="true" id="state" value="{!state}" /> -->
                <b>Region:</b>
                <apex:selectList id="rgn" value="{!SelectedRegion}" size="1" >
                    <apex:selectOptions value="{!RegionList}" />
                </apex:selectList>

 

 

///////////////////////Controller////////////////////////

    public String SelectedState { get; set; }
    public String SelectedRegion { get; set; }

    private final UV_Account__c a;
    public set<SelectOption> StateList{
    get{
            set<SelectOption> st= new set<SelectOption>();
             st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select State__c from UV_Account__c order by Name];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.State__c) == FALSE){
               sNames.add(c.State__c);
               lFINAL.add(c);
        }
        }
            
            for (UV_Account__c fc : lFINAL){
            st.add(new SelectOption(fc.id,fc.State__c));
              }
            
            return st;
       }
     set; }

    public list<SelectOption> RegionList{
    get{
            list<SelectOption> st= new list<SelectOption>();
            st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select Region__c from UV_Account__c where State__c= :SelectedState];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.Region__c) == FALSE){
               sNames.add(c.Region__c);
               lFINAL.add(c);
        }
        }
            
            for( UV_Account__c fc : lFINAL)
            {
                st.add(new SelectOption(fc.id,fc.Region__c));
            }
            return st;
       }
     set; }

Im tring to display a picklist from my custom object.

Facing this error: Invalid selectOptions found. Use SelectOption type in Apex.

 

////////////VF////////////////////
                <apex:selectList id="sta" value="{!SelectedState}">
                    <apex:selectOption value="{!StateList}" />
                </apex:selectList>

 

 

////////////////////////Controller////////////////////////

public with sharing class salesofficer {

    public list<SelectOption> StateList {
    get{
            list<SelectOption> st= new list<SelectOption>();
            Schema.DescribeFieldResult fieldResult = UV_Dealer__c.City__c.getDescribe();
            List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
            for( Schema.PicklistEntry f : ple)
            {
                st.add(new SelectOption(f.getLabel(), f.getValue()));
            }
            return st;
       }
     set; }

    public String SelectedState { get; set; }

 

 

Please help me in this code or suggest me any other easist way to do the same thing

///////Visualforce////////

<apex:page standardController="Student__c" extensions="Student">
<apex:pageblock title="New Account">
<apex:pageBlockSection title="Register">
<apex:form >
<b>Username:</b> <br/>
<apex:inputText required="true" id="username" value="{!Student__c.Name}" /> <br/>
<b>Password:</b> <br/>
<apex:inputSecret required="true" id="password" value="{!Student__c.Mobile__c}"/> <br/>
<b>Email:</b> <br/>
<apex:inputText required="true" id="emailid" value="{!Student__c.Email__c}" /> <br/>
<b>Phone Number:</b> <br/>
<apex:inputText required="true" id="phno" value="{!Student__c.Height__c}" /> <br/> <br/>

<apex:commandButton value="Register" action="{!register}"/> <t/> <t/>
<apex:commandButton value="Existing User" action="{!pbck}"/> <br/> <br/>
</apex:form>
</apex:pageBlockSection>

</apex:pageblock>


</apex:page>

 

 

 

/////Controller////////

 

public with sharing class Student {
private final Student std;

public String Name{ get; set; }
public Double Height__c{ get; set; }
public String Email__c{ get; set; }
public String Mobile__c { get; set; }

list<student__c> stdlist=[select id, Name, Height__c, Email__c, Mobile__c from student__c where id=:ApexPages.currentPage().getParameters().get('id')];

public Student(ApexPages.StandardController controller) {
this.std= (Student)Controller.getRecord();
}

public PageReference pbck() {

return page.mylogin;
}


public PageReference register() {
insert stdlist;
return page.mylogin;
}

}

 

 

Im facing following errors:

1: Error: Student Compile Error: Invalid identifier: Height__c at line 5 column 13

2: Error: Student Compile Error: Incompatible types since an instance of SObject is never an instance of Student at line 12 column 19

 

 

for 1st error, i tried all the premitive data types, still that error is there.

Im new in SFDC. Im trying to develop a login page and a Register User page without using any standard controller and standard object. trying to crate independent custom page which do not use any standard objects or standard fields. can anyone tell me how to develop these two pages?

mail me code @ admn.vinayurkude@gmail.com

thanks & Regards,

Vinay

I'm new on salesforce.

I'm trying to create dependent fields according to picklist value selection.

In the following code I want:

1: when I select "None" in picklist no field should display.

2: if I select 1st option in the picklist; only field1 should get display.

3: if I select 2nd option in the picklist; only field2 should get display.

3: and if I select 3rd option in the picklist; all the fields1,2&3 should get display.

 

Please Help me out of this task.. Thanks!

 

/////////////////////Visualforce///////////////////////

<apex:page controller="FieldSelection">
      <apex:pageBlock title="fields">
          <apex:form >
                <b>State:</b> <t/><t/>
                <apex:selectList id="sta" value="{!SelectedState}" size="1">
                    <apex:selectOptions value="{!StateList}" />
                </apex:selectList>
                <br/><br/>
                <b>Field1:</b><t/><t/>
                <apex:inputText required="true" id="city1" value="{!city1}" />
                <br/><br/>
                <b>Field2:</b><t/><t/>
                <apex:inputText required="true" id="city2" value="{!city2}" />
                <br/><br/>
                <b>Field3:</b><t/><t/>
                <apex:inputText required="true" id="city3" value="{!city3}" />
                
          </apex:form>
      </apex:pageBlock>
</apex:page>

 

 

 

/////////////////////////Controller/////////////////////////////////

public with sharing class FieldSelection {

    public String city3 { get; set; }

    public String city2 { get; set; }

    public String city1 { get; set; }

    public String SelectedState { get; set; }
    
    public list<SelectOption> StateList{
    get{
            list<SelectOption> st= new list<SelectOption>();
            st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select State__c from UV_Account__c];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.State__c) == FALSE){
               sNames.add(c.State__c);
               lFINAL.add(c);
        }
        }
            
            for( UV_Account__c fc : lFINAL)
            {
                st.add(new SelectOption(fc.id,fc.State__c));
            }
            return st;
       }
     set; }

}

 

Dependent picklist values are not fetching.

 

How to make dependent field uneditable if parent field is not selected and if parent field is selected dependent field should show appropriate list values?

Please help me out from this.. Thanks!

 

///////////////////VF//////////////////////////////

              <apex:pageBlockSection title="Header" columns="4">
                <b>State:</b>
                <apex:selectList id="sta" value="{!SelectedState}" size="1">
                    <apex:selectOptions value="{!StateList}" />
                </apex:selectList>
                <!--  required="true" id="state" value="{!state}" /> -->
                <b>Region:</b>
                <apex:selectList id="rgn" value="{!SelectedRegion}" size="1" >
                    <apex:selectOptions value="{!RegionList}" />
                </apex:selectList>

 

 

///////////////////////Controller////////////////////////

    public String SelectedState { get; set; }
    public String SelectedRegion { get; set; }

    private final UV_Account__c a;
    public set<SelectOption> StateList{
    get{
            set<SelectOption> st= new set<SelectOption>();
             st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select State__c from UV_Account__c order by Name];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.State__c) == FALSE){
               sNames.add(c.State__c);
               lFINAL.add(c);
        }
        }
            
            for (UV_Account__c fc : lFINAL){
            st.add(new SelectOption(fc.id,fc.State__c));
              }
            
            return st;
       }
     set; }

    public list<SelectOption> RegionList{
    get{
            list<SelectOption> st= new list<SelectOption>();
            st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select Region__c from UV_Account__c where State__c= :SelectedState];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.Region__c) == FALSE){
               sNames.add(c.Region__c);
               lFINAL.add(c);
        }
        }
            
            for( UV_Account__c fc : lFINAL)
            {
                st.add(new SelectOption(fc.id,fc.Region__c));
            }
            return st;
       }
     set; }

Im tring to display a picklist from my custom object.

Facing this error: Invalid selectOptions found. Use SelectOption type in Apex.

 

////////////VF////////////////////
                <apex:selectList id="sta" value="{!SelectedState}">
                    <apex:selectOption value="{!StateList}" />
                </apex:selectList>

 

 

////////////////////////Controller////////////////////////

public with sharing class salesofficer {

    public list<SelectOption> StateList {
    get{
            list<SelectOption> st= new list<SelectOption>();
            Schema.DescribeFieldResult fieldResult = UV_Dealer__c.City__c.getDescribe();
            List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
            for( Schema.PicklistEntry f : ple)
            {
                st.add(new SelectOption(f.getLabel(), f.getValue()));
            }
            return st;
       }
     set; }

    public String SelectedState { get; set; }

 

 

Please help me in this code or suggest me any other easist way to do the same thing

///////Visualforce////////

<apex:page standardController="Student__c" extensions="Student">
<apex:pageblock title="New Account">
<apex:pageBlockSection title="Register">
<apex:form >
<b>Username:</b> <br/>
<apex:inputText required="true" id="username" value="{!Student__c.Name}" /> <br/>
<b>Password:</b> <br/>
<apex:inputSecret required="true" id="password" value="{!Student__c.Mobile__c}"/> <br/>
<b>Email:</b> <br/>
<apex:inputText required="true" id="emailid" value="{!Student__c.Email__c}" /> <br/>
<b>Phone Number:</b> <br/>
<apex:inputText required="true" id="phno" value="{!Student__c.Height__c}" /> <br/> <br/>

<apex:commandButton value="Register" action="{!register}"/> <t/> <t/>
<apex:commandButton value="Existing User" action="{!pbck}"/> <br/> <br/>
</apex:form>
</apex:pageBlockSection>

</apex:pageblock>


</apex:page>

 

 

 

/////Controller////////

 

public with sharing class Student {
private final Student std;

public String Name{ get; set; }
public Double Height__c{ get; set; }
public String Email__c{ get; set; }
public String Mobile__c { get; set; }

list<student__c> stdlist=[select id, Name, Height__c, Email__c, Mobile__c from student__c where id=:ApexPages.currentPage().getParameters().get('id')];

public Student(ApexPages.StandardController controller) {
this.std= (Student)Controller.getRecord();
}

public PageReference pbck() {

return page.mylogin;
}


public PageReference register() {
insert stdlist;
return page.mylogin;
}

}

 

 

Im facing following errors:

1: Error: Student Compile Error: Invalid identifier: Height__c at line 5 column 13

2: Error: Student Compile Error: Incompatible types since an instance of SObject is never an instance of Student at line 12 column 19

 

 

for 1st error, i tried all the premitive data types, still that error is there.

Im new in SFDC. Im trying to develop a login page and a Register User page without using any standard controller and standard object. trying to crate independent custom page which do not use any standard objects or standard fields. can anyone tell me how to develop these two pages?

mail me code @ admn.vinayurkude@gmail.com

thanks & Regards,

Vinay