1

I created a simple Lightning Salesforce1 app based on a custom VF page. App is done for iPhone/iOS devices. Among others, in this VF page I added an editable box using the apex:inputField method, so that people cann add, delete or edit the information which is there.

Code is very simple, find it below:

<apex:inputField style="width:250px;height:50px" id="Status" required="false" value="{!account.Last_Status__c}" />

See "Current_Status" field in the screenshot below: enter image description here

At the first click in the box, everything works just fine. I am able to delete, add or edit content in the box highlited in red in the above image. But whenever I click in the box AGAIN while in the text editor context (see screenshot below) the cursor is blocked, I cannot do any modifications anymore (apart from eventually clicking on "Select", "Select all" or "Copy || Paste" options) and the only option I have left is pressing the Done button. After that, clicking again in the box things will work again until a new click is done in the box while in the text editor, and so on. How could I solve this issue?

enter image description here

Thanks a lot in advance to anyone who will take some time to look at this and advice.

Kind regards,

Francesco ALFEO

  • try using apex:input instead of apex:inputField .. developer.salesforce.com/docs/atlas.en-us.salesforce1.meta/… – Vamsi Krishna Aug 5 '15 at 11:30
  • Thanks Vamsi, but it doesn't work in my case as it doesn't support the "value" attribute.. – Francesco Alfeo Aug 5 '15 at 12:37
  • apex:input has value attribute. but you cannot bind it to an SObject Field. you can store the account.Last_Status__c field into a controller variable and then bind that variable to value attribute of your apex:input – Vamsi Krishna Aug 5 '15 at 12:43
  • Hello and thanks again Vamsi, I did what you suggested but problem is exactly the same as before. Moreover the text window has this "Go" button which behavior I don't like at all.. So, for now, keeping my previous solution (unless there is something I'm still missing here). Code snippet below: - VF PAGE: <apex:input style="width:250px;height:50px" id="Status" required="false" value="{!Current_Status}" /> - controller: public String Current_Status {get; set;} [...] Current_Status = account.Last_Status__c; Any other ideas? :) Francesco – Francesco Alfeo Aug 5 '15 at 13:32
1

So I worked on this a while ago, and the issue is because of the UIWebView on the native iOS side. UIWebView if you're not familiar is the component used to embed web pages in an iOS app.

The phone just has this issue, and there wasn't anything we could do to work around it.

The solution will be for Salesforce to upgrade to the WKWebView, but I'm unsure when that will happen. WKWebView had some bugs that prevented us from being able to support it last I heard.

|improve this answer|||||
  • 1
    Thanks a lot for your feedback Kris! Yes, I was starting to have the same feeling too unfortunately.. – Francesco Alfeo Aug 19 '15 at 13:40
1

I believe this is related to the fact that Visualforce pages within Salesforce1 (and Lightning apps in general) are embedded within an iframe. Touch events fired on the input, after initial focus, cause the iframe to lose focus and the parent window receives focus instead.

I found a workaround that recommended responding to the keydown event and then restoring focus back to the iframe window. I have modified this (and found better results) from responding to the touchend event and then restoring focus:

window.addEventListener('touchend', function () {
     window.focus();
});

Here is some more information regarding this issue and the original workaround (using the keydown event):

|improve this answer|||||

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.