0

I have a simple visualforce page where doctype=HTML 5.when I enter the account name and click save its not saving to object. any help will be greatly appreciated.

<apex:page docType="HTML-5.0" 
           standardController="Account"
           standardStylesheets="false"
           showheader="false"
           sidebar="false">
<tr>
<td>
Account Name:
</td>
<td>
<Input type="Text"/> 
</td>
</tr>
<apex:form >
<apex:commandButton action="{!Save}"
                    value="Save" />
  • 1
    How does your page looks like? Can you post some code snippets here? – Salesforcesmarty May 11 '17 at 3:09
  • <apex:page docType="HTML-5.0" standardController="Account" standardStylesheets="false" showheader="false" sidebar="false"><tr> <td> Account Name: </td> <td> <Input type="Text"/> </td> </tr> <apex:form > <apex:commandButton action="{!Save}" value="Save" /> </apex:form> – Divya Manohar May 11 '17 at 3:11
0

Important to note that there is a set of supported HTML tags that you can use when developing visualforce pages available here along with attributes.

You will also want to go through the list of Standard Components Reference available here if you will be developing in Salesforce.

If you read carefully, you will notice that:

<Input type="Text"/>

Is not supported.

Last but not least, the H&T Portal is a great reference source for searching prior to asking.

|improve this answer|||||
2

You should use input field here as you are using StandardController without any extensions. Refer apex:inputField

An HTML input element for a value that corresponds to a field on a Salesforce object. The component respects the attributes of the associated field, including whether the field is required or unique, and the user interface widget to display to get input from the user. For example, if the specified component is a date field, a calendar input widget is displayed. When used in an , tags automatically display with their corresponding output label.

<apex:page docType="HTML-5.0" 
           standardController="Account"
           standardStylesheets="false"
           showheader="false"
           sidebar="false">
<apex:form >
<tr>
<td>
Account Name:
</td>
<td>
<apex:inputField value="{!Account.Name}"/> 
</td>
</tr>

<apex:commandButton action="{!Save}"
                    value="Save" />
|improve this answer|||||
  • thnx its working. cud I ask u a little more?will there be any viewstate issues if using HTML5 assuming lot of fields are present, also can this same page be rendered in a mobile? – Divya Manohar May 11 '17 at 3:34
  • 1
    Hi how did u keep <apex:inputfield> in the <tr><td>?I get an error saying <apex:inputfield> should be placed within the form tag. – Divya Manohar May 11 '17 at 4:06
  • you need to put inside <apex:form>, I have not compiled, just given some guidance. updated my ans – Santanu Boral May 11 '17 at 4:45
  • @DivyaManohar HTML tags don't increase your view state as they are not counted in internal view state. – Rohit Mourya May 11 '17 at 4:51
  • @DivyaManohar if my answer solves your purpose then accept this, so that others may find this useful – Santanu Boral May 11 '17 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.