+ Start a Discussion
Nirmal ChristopherNirmal Christopher 

Issue in setting values for the controller?

in VF  page
<apex:pageBlockSectionItem >            
          
             <apex:outputLabel value="" style="font-style:italic;font-weight:bold"  >
              <apex:outputText value="Job Title" ></apex:outputText>
              </apex:outputLabel>                            
              <apex:inputtext value="{!jobtitle }" />       
            </apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
            <apex:outputLabel value="Job Description" style="font-weight:italic;font-weight:bold">
                </apex:outputLabel>
                    <apex:inputTextarea value="{!jobDescription2}" required="true"/>        
            </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem >

In controller

public with sharing class help{

    public string jobtitle {get;set;}

    public string jobDescription2{get;set;}


public Pagereference send_email2(){
    string id=userinfo.getuserid();
   firstName=userinfo.getfirstname();
   lastName=userinfo.getlastname();
   user u1 =[select id,firstname,lastname,Companyname,phone,email from user where id=:id limit 1];
 
   Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
   String[] toAddresses = new String[] {'nchristopher@gtr.net'};
      system.debug('+++++++'+jobtitle);
      system.debug('+++++++'+jobDescription2);
   mail.setToAddresses(toAddresses );
   mail.setReplyTo('nchristopher@gtr.net');
   mail.setSubject('New Support request from -'+u1.companyName);
   mail.setBccSender(false);
   mail.setUseSignature(false);
  // if(selectionstage1=='Report-Issue' ){
   mail.setHtmlBody('Hi GTR Support,<p/> This is to inform you that there is a new support request from'+u1.Companyname+', The details are given below <br/> <table><tr><td> User Name: &nbsp;'+u1.firstname+'&nbsp;'+u1.lastname+'</td></tr><tr><td>Phone Number: &nbsp;'+u1.Phone+'</td></tr><tr><td>E-mail: &nbsp;'+u1.email+'</td></tr><tr><td>Support Type: Recruiting Help From GTR</td></tr><tr><td>Issue Description: &nbsp;'+jobDescription2+'</td><td>Job Title:'+jobtitle+'</td></tr></table>'  );
  
 
   Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
 
   return null;
   }
}


The text area and text field component prints null if send_email2 button is invoked....because of this i am unable to get the user inputs. What might be the issue. the same code works fine in my devloper acc...but in the sandbox its not working.
Vinita_SFDCVinita_SFDC
Hello,

Please try replicating the issue and check debug logs for exact error.

Path: Setup|App setup|Monitoring|debug logs
Nirmal ChristopherNirmal Christopher
Hi Vinita,
   I found the root cause of the issue i was using immediate="true" attribute in the apex command buttton so the compiler skipped the validation chack and user input , but was sending the mails sucessfully but if i remove the Immediate atribute controller method is not invoked. in debug logs i can't see any statement which is given on the method. I am using Apex tabs to put all the VF components is that doing any conflict with the method invoking i will share the entire code for ur reference if u wish.