Activity › Forums › Salesforce® Discussions › Apex Inputfield not working in Salesforce1?
Tagged: Apex Input Field, Salesforce Apex, Salesforce Apex Class, Salesforce Apex Code, Salesforce Apex Function, Salesforce1, Salesforce1 App
-
Apex Inputfield not working in Salesforce1?
Posted by Shubham on April 26, 2018 at 5:16 PMApex Inputfield not working in Salesforce1 for the type Lookup when opened in Mobile.
Aman replied 8 years ago 3 Members · 2 Replies -
2 Replies
-
Hi Shubham,
It is a known limitation of Salesforce1 Mobile and is documented in the Salesforce1 App Developer’s Guide.
From the Salesforce1 App Developer’s Guide section, Visualforce Components to Avoid in Salesforce1:
Using <apex:inputField> is fine for fields that display as a basic input field, like text, email, and phone numbers, but avoid using it for field types that use an input widget, such as date and lookup fields.
Thanks.
- [adinserter block='9']
-
Hi Shubham,
You can use the below code to create apex input field for the type look up :
<apex:page docType=”html-5.0″ standardController=”Deal__c” extensions=”PositionNoteDealActionController” sidebar=”false” showHeader=”false” applyHtmlTag=”false”>
<html xmlns=”http://www.w3.org/2000/svg” xmlns:xlink=”http://www.w3.org/1999/xlink”>
<head>
<meta charset=”utf-8″ />
<meta http-equiv=”x-ua-compatible” content=”ie=edge” />
<meta name=”viewport” content=”width=device-width, initial-scale=1″ />
<apex:stylesheet value=”{!URLFOR($Resource.salesforce_lightning, ‘assets/styles/salesforce-lightning-design-system-vf.min.css’)}” /></head>
<body>
<div class=”yourcompanyname”>
<apex:form ><div class=”slds-form-element”>
<label class=”slds-form-element__label” >Opportunity</label>
<div class=”slds-form-element__control slds-input-has-icon slds-input-has-icon–right”>
<a href=”javascript:%20openLookup%28%27%2F_ui%2Fcommon%2Fdata%2FLookupPage%3Flkfm%3Dj_id0%253Aj_id4%26lknm%3Dj_id0%253Aj_id4%253Aj_id7%26lktp%3D%27%20%2B%20getElementByIdCS%28%27j_id0%3Aj_id4%3Aj_id7_lktp%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27j_id0%3Aj_id4%3Aj_id7%27%29.value.substring%280%2C%2080%29%29%29″ id=”j_id0:j_id4:j_id7_lkwgt” onclick=”setLastMousePosition(event)” title=”Opportunity Lookup (New Window)”>
<svg aria-hidden=”true” class=”slds-input__icon slds-icon-text-default” >
<use xlink:href=”{!URLFOR($Resource.salesforce_lightning, ‘/assets/icons/utility-sprite/svg/symbols.svg#search’)}”></use>
</svg>
</a>
<apex:inputField styleClass=”slds-input” type=”text” value=”{!positionNote.Opportunity__c}”/>
</div>
</div>
</apex:form>
</div>
</body></html>
</apex:page>
The salesforce_lightning resource comes from the css-customizer on the lightning design system site. Just upload the entire zip as a static resource.The href on the anchor tag is copied directly from the lookup icon if using regular salesforce styling.
Log In to reply.