• Pardhu
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

Hello.. Iam newbiee to salesforce.com..

i have a problem in comparing the the value that i give in vf to the value already stored in an object.

 

My programming seems to be Clumpzy..Plz humour me..

 

Here is the code which i have written..

 

vf page :- 

 

  <apex:page controller="test3con" showHeader="false" sidebar="false">

        <apex:form >
                <apex:sectionHeader title="Game ON!!!" subtitle="Salesforce A Day..."/>
                      <apex:pageblock >

                 <apex:pageblockTable value="{!id}" var="g" >

              <apex:column value="{!g.Question__c}"/><br/>

                     </apex:pageblockTable><br/>
              Answ:- <apex:inputText value="{!ans}"/> <br/><br/>
               <apex:messages />

<br/>
                    <apex:commandButton value="Submit" action="{!click}"/> &nbsp;&nbsp;
                 <apex:commandButton value="Refresh" action="{!refresher}"/>

         </apex:pageblock>
      </apex:form>
</apex:page>

 

 

Controller :-

 

 

public class test3con {

public PageReference refresher() {

pagereference pr = new pagereference('/apex/test3');

return pr;
}


public PageReference click() {
project__c g = new project__c();


if( g.Answer__c == ans ){

ApexPages.Message errMs= new ApexPages.Message(ApexPages.Severity.ERROR, 'Correct Answer');
ApexPages.addMessage(errMs);
insert g;
system.debug('----------'+g.Answer__c);
return null;
}
else
{
ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Wrong Answer');
ApexPages.addMessage(errMsg);
return null ;
}

 

}
public String ans { get; set; }


public List<project__c> id {get; set;}
Public test3con() {

id = [SELECT Question__c FROM project__c where ID ='a0090000009huAz' ];

}

}

 

ID ='a0090000009huAz'   this is record id in the object "project__C"

Iam mission out something herer..which iam unable to understand. iam unable to compare the value which i give in that textfeild..to that value stored in that object..as record....  

 

Kindly help me out in solving this problem

 

Regards

 

Pardha saradhi.

 

 

  • February 01, 2013
  • Like
  • 0
how to create force.com sites?
  • February 02, 2013
  • Like
  • 0

Hello Guys,

 

I am a System Admin, but have this issue when I select Profiles:


Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

 

My code seems to be correct. Any advise will be appreciated.

 

Thanks

 

Anikaa

Hello.. Iam newbiee to salesforce.com..

i have a problem in comparing the the value that i give in vf to the value already stored in an object.

 

My programming seems to be Clumpzy..Plz humour me..

 

Here is the code which i have written..

 

vf page :- 

 

  <apex:page controller="test3con" showHeader="false" sidebar="false">

        <apex:form >
                <apex:sectionHeader title="Game ON!!!" subtitle="Salesforce A Day..."/>
                      <apex:pageblock >

                 <apex:pageblockTable value="{!id}" var="g" >

              <apex:column value="{!g.Question__c}"/><br/>

                     </apex:pageblockTable><br/>
              Answ:- <apex:inputText value="{!ans}"/> <br/><br/>
               <apex:messages />

<br/>
                    <apex:commandButton value="Submit" action="{!click}"/> &nbsp;&nbsp;
                 <apex:commandButton value="Refresh" action="{!refresher}"/>

         </apex:pageblock>
      </apex:form>
</apex:page>

 

 

Controller :-

 

 

public class test3con {

public PageReference refresher() {

pagereference pr = new pagereference('/apex/test3');

return pr;
}


public PageReference click() {
project__c g = new project__c();


if( g.Answer__c == ans ){

ApexPages.Message errMs= new ApexPages.Message(ApexPages.Severity.ERROR, 'Correct Answer');
ApexPages.addMessage(errMs);
insert g;
system.debug('----------'+g.Answer__c);
return null;
}
else
{
ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Wrong Answer');
ApexPages.addMessage(errMsg);
return null ;
}

 

}
public String ans { get; set; }


public List<project__c> id {get; set;}
Public test3con() {

id = [SELECT Question__c FROM project__c where ID ='a0090000009huAz' ];

}

}

 

ID ='a0090000009huAz'   this is record id in the object "project__C"

Iam mission out something herer..which iam unable to understand. iam unable to compare the value which i give in that textfeild..to that value stored in that object..as record....  

 

Kindly help me out in solving this problem

 

Regards

 

Pardha saradhi.

 

 

  • February 01, 2013
  • Like
  • 0