You need to sign in to do that
Don't have an account?
anilp
System.DmlException: Insert failed.
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Account Name]: [Account Name]
Error is in expression '{!save}' in component <apex:page> in page accountinsert...........
Please help , i have facing this problem in insert a fileds into an object
Hi
here you are inserting a record with filling the Required fields.While creating any record you should give all the Required information.
If you still facing any problem please provide the code, then i can help you out.
All Answers
Hi
here you are inserting a record with filling the Required fields.While creating any record you should give all the Required information.
If you still facing any problem please provide the code, then i can help you out.
public class accountinsertconrol
{
public String Name{set;get;}
public String Phone{set;get;}
public String Website{set;get;}
public pagereference save()
{
account acc =new account();
acc.Name=Name;
acc.website=website;
acc.phone=phone;
insert acc;
pagereference page = new pagereference('/'+acc.id);
return page;
}
}
<apex:page controller="accountinsertconrol" sidebar="false">
<apex:form >
<apex:pageBlock title="Insert a Record into Account Object">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputText value="{!Name}">Account Name </apex:inputText>
<apex:inputText value="{!Phone}">Account Phone </apex:inputText>
<apex:inputText value="{!Website}">Account Website</apex:inputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
::::::::::::::::::::::::::::::::::::::::::::::::;
i dnot enter any values , then i click the save button then the page is in normal , no error messages genaratted, like
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Account Name]: [Account Name]
Thank u ,
please see the below code..................
<apex:page controller="accountinsertconrol" sidebar="false">
<apex:form >
<apex:pageBlock title="Insert a Record into Account Object">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputText value="{!Name}">Account Name </apex:inputText>
<apex:inputText value="{!Phone}">Account Phone </apex:inputText>
<apex:inputText value="{!Website}">Account Website</apex:inputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class accountinsertconrol
{
public String Name{set;get;}
public String Phone{set;get;}
public String Website{set;get;}
public pagereference save()
{
account acc =new account();
acc.Name=Name;
acc.website=website;
acc.phone=phone;
insert acc;
pagereference page = new pagereference('/'+acc.id);
return page;
}
}