You need to sign in to do that
Don't have an account?

How can i save email field in custom object
Hi,
I have created custom field that is email in Custom object. I need to display email field in custom object A when i save the button.Code is working fine but email field not saved in Custom object .Why this happening.could you give any suggestion thanks in advance.
My VF code:
<apex:page Controller="kathir">
<apex:form >
<apex:pageBlock title="Universal Containers">
<apex:outputLabel value="Email Address" for="hh"/>
<apex:inputText value="{!Email}" id="hh"/>
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class kathir{ public PageReference save() { return null; } public String email{ get; set; } public String getAccount() { return null; } public String account { get; set; }public string Name{get;set;}{}public string Information{get;set;}{}}
I have created custom field that is email in Custom object. I need to display email field in custom object A when i save the button.Code is working fine but email field not saved in Custom object .Why this happening.could you give any suggestion thanks in advance.
My VF code:
<apex:page Controller="kathir">
<apex:form >
<apex:pageBlock title="Universal Containers">
<apex:outputLabel value="Email Address" for="hh"/>
<apex:inputText value="{!Email}" id="hh"/>
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class kathir{ public PageReference save() { return null; } public String email{ get; set; } public String getAccount() { return null; } public String account { get; set; }public string Name{get;set;}{}public string Information{get;set;}{}}
public class MyController {
private customobject__ c A;
public customobject__ c getOpp(){
if(A== null)
A=new customobject__ c();
return A;
}
public PageReference save() {
insert A;
return null;
}
}
<apex:page controller="myController" tabStyle="Account">
<apex:form>
<apex:pageblock>
<apex:pageblockbutton>
<apex:commandButton action="{!save}" value="save"/>
<apex:pageblocksection>
You belong to Account Name: <apex:inputField value="{!A.Email}"/>
</apex:pageblocksection>
</apex:pageblockbutton>
</apex:pageBlock>
</apex:form>
</apex:page>
VF:
<apex:page Controller="kathir">
<apex:form >
<apex:pageBlock title="Universal Containers">
<!--<apex:pageBlockTable value="{!account.Contacts}" var="item">-->
<apex:outputLabel value="Email Address" for="hh"/>
<apex:inputText value="{!Email}" id="hh"/>
<apex:commandButton value="save" action="{!save}"/>
<!--</apex:pageBlockTable> -->
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class kathir
{
public String email1 { get; set; }
public String email{ get; set; }
public PageReference save() {
MyForce__A__c emailupdate=new MyForce__A__c();
emailupdate.Name='test';
emailupdate.MyForce__email__c=email;
insert emailupdate;
return null;
}
}
Regards,
kathir