You need to sign in to do that
Don't have an account?
Jainendra Jeet 6
Trying to input record in my custom object's custom field
I was trying to input record in my custom object's custom field
Custom Object Merchandise (API Merchandise__c)
Custom Field(API i guess will be Price__c)
VF page :
<apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form>
</apex:page><apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form></apex:page>
Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
public Merchandise__c Price__c {get;set;}
//private Apexpages.StandardController controller;
public String Name { get; set; }
public void Save() {
mer = new Merchandise__c();
mer.Name = Name;// 'test_p';
mer.Price__c = Price__c;
insert mer;}}
But its giving error . Can you please suggest I was trying to input record in my custom object's custom field
Custom Object Merchandise (API Merchandise__c)
Custom Field(API i guess will be Price__c)
VF page :
<apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form>
</apex:page><apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form></apex:page>
Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
public Merchandise__c Price__c {get;set;}
//private Apexpages.StandardController controller;
public String Name { get; set; }
public void Save() {
mer = new Merchandise__c();
mer.Name = Name;// 'test_p';
mer.Price__c = Price__c;
insert mer;}}
But its giving error . Can you please suggest
Custom Object Merchandise (API Merchandise__c)
Custom Field(API i guess will be Price__c)
VF page :
<apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form>
</apex:page><apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form></apex:page>
Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
public Merchandise__c Price__c {get;set;}
//private Apexpages.StandardController controller;
public String Name { get; set; }
public void Save() {
mer = new Merchandise__c();
mer.Name = Name;// 'test_p';
mer.Price__c = Price__c;
insert mer;}}
But its giving error . Can you please suggest I was trying to input record in my custom object's custom field
Custom Object Merchandise (API Merchandise__c)
Custom Field(API i guess will be Price__c)
VF page :
<apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form>
</apex:page><apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputtext value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form></apex:page>
Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
public Merchandise__c Price__c {get;set;}
//private Apexpages.StandardController controller;
public String Name { get; set; }
public void Save() {
mer = new Merchandise__c();
mer.Name = Name;// 'test_p';
mer.Price__c = Price__c;
insert mer;}}
But its giving error . Can you please suggest
Please try below code and let me know.
VF page :
<apex:page controller="InsertMerchandise">
<apex:form >
<apex:inputtext value="{!Name}"/>
<apex:inputField value="{!mer.Price__c}"/>
<apex:commandButton id="Save" value="Save" action="{!Save}"/>
</apex:form>
</apex:page>
Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
public InsertMerchandise()
{
mer= new Merchandise__c();
}
//private Apexpages.StandardController controller;
public String Name { get; set; }
public void Save() {
mer.Name = Name;// 'test_p';
insert mer;}
}
Best Regards,
-Vivek
You can try the below code.
VF Page:
<apex:page controller="InsertMerchandise">
<apex:form>
<apex:pageBlock >
<apex:pageBlockSection title="Enter Record Details: " columns="1">
<apex:inputField value="{!mer.name}"/>
<apex:inputField value="{!mer.price__c}"/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class InsertMerchandise {
public Merchandise__c mer {get; set;}
public InsertMerchandise()
{
mer = new Merchandise__c();
}
public pagereference save()
{
insert mer;
mer.clear();
return null;
}
}
Thank you,
Satya