• Mark Robinson 42
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Expected result is 5+001=006..

Used Formula TEXT(Value()+Value()), 

Now I got a value is 5+001=6

Input field - Text field
output field - Text Field because receive the lead zero
Here, I couldnt save my values in vf page, check my code below, thanks in Advance!

Controller
public class ExtensionClass {
Design_Form__c design;
private ApexPages.StandardController controller;
public ExtensionClass(ApexPages.StandardController controller) {
this.controller = controller;
}
public class fields{
 
  public String id{ get; set;}
 }
 fields[] x= new fields[]{};
 
 Public fields[] getx()
 {
  return x;
 }
 
 public ExtensionClass ()
 {
  x.add(new fields());
 }
 Public void savex()
 {

  Design_Form__c [] entriesToSave = new Design_Form__c[]{};
}

public PageReference SaveRecord() {

  if(controller.save() != null) {
    PageReference pr= Page.ColorV;
    pr.setRedirect(true);
    pr.getParameters().put('id',controller.getId());
    return pr;
  }
   return null;
}

}

Vf Page
<apex:page standardController="Design_Form__c" extensions="ExtensionClass" >
<apex:form >
<apex:pageBlock title="">
<apex:pageBlockButtons >
        <apex:commandButton action="{!SaveRecord}" value="Save"/>
        
    </apex:pageBlockButtons>
<apex:pageBlockSection >
   <html>
      <head>
         <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css"/>
         <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
         <script type="text/javascript">
            $(document).ready(function(){  
            $.getJSON( "https://plastekcards--ethansb--c.visualforce.com/resource/1572936099000/PantoneJson", function( data ) {                     
            $("select").select2({
            data: data,
            templateResult: template,
            escapeMarkup: function(m) {
              return m;
            }
            });            
            });    
            function template(data) {
                return '<div><span style="display: inline-block; width:1rem; height:1rem; margin-right:0.5rem; vertical-align:left; background: '+ data.hex +'"></span>'+data.text+'</div>'; 
            }  
            });      
         
  </script>
    
      </head>
      
      <body>
      
       <select id="Pan" style="width: 250px" multiple="multiple"></select>
      </body>
   </html>
    
    </apex:pageBlockSection>
  </apex:pageBlock>
   </apex:form>
</apex:page>


 
Expected result is 5+001=006..

Used Formula TEXT(Value()+Value()), 

Now I got a value is 5+001=6

Input field - Text field
output field - Text Field because receive the lead zero
I'm following the examples as given in the updated documentation.
 
<aura:component>
    <lightning:recordEditForm recordId="003XXXXXXXXXXXXXXX" objectApiName="Contact">
        <lightning:messages />
        <lightning:inputField fieldName="FirstName" />
        <lightning:inputField fieldName="LastName" />
        <lightning:inputField fieldName="Email" />
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" />
    </lightning:recordEditForm>
</aura:component>
Inserting a recordId in the above example results in the following error:
[Error in $A.getCallback() [Cannot read property 'value' of undefined]]
Even the second example, attempting to create a record, is throwing an error:
<aura:component>
    <lightning:recordEditForm aura:id="recordEditForm" 
                           objectApiName="Contact">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:button class="slds-m-top_small" type="submit" label="Create new" />
    </lightning:recordEditForm>
</aura:component>
In the above code, there are two separate errors happening:

1) I'm getting the error 'Cannot read property 'defaultRecordTypeId' of undefined' even though there are no record types associated with my Conatct object.  To get around this error, I have created a record type and I'm now passing in the recordTypeId.  Updated code looks like:
<aura:component>
    <lightning:recordEditForm aura:id="recordEditForm" 
                           objectApiName="Contact"
                           recordTypeId="XXXXXXXXXXXXX">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:button class="slds-m-top_small" type="submit" label="Create new" />
    </lightning:recordEditForm>
</aura:component>
2) Now that I'm past the recordTypeId error, I now receive this error:
cannot read property 'fields' of undefined

I understand that this new component is in Beta for the current release, but I wanted to understand if the documentation is incomplete, if I'm making some simple error that I cannot see, or if the feature is not fully functional yet.