3

With the new iOS8, certain form elements are not triggering events within Salesforce1 using Visualforce. For instance:

<button id="submitButton" enabled="false">submit</button>

Will not trigger a click event. This is a known issue: https://success.salesforce.com/issues_view?id=a1p30000000T5hOAAS

4

As noted in the success post, the following JavaScript will fix the issue:

    (function(){try{var a=navigator.userAgent; 
if((a.indexOf('Salesforce')!=-1)&&(a.indexOf('iPhone')!=-1||a.indexOf('iPad')!=-1)&&(a.indexOf('OS/8')!=-1||a.indexOf('OS 8')!=-1)&&(a.indexOf('Safari')==-1)){ 
var s=document.createElement('style'); 
s.innerHTML="html,html body{overflow: auto;-webkit-overflow-scrolling:touch;}body{position:absolute;left:0;right:0;top:0;bottom:0;}"; 
document.getElementsByTagName('head')[0].appendChild(s);}}catch(e){}})(); 

var ua=navigator.userAgent; 
if((ua.indexOf('Salesforce')!=-1)&&(ua.indexOf('iPhone')!=-1||ua.indexOf('iPad')!=-1)&&(ua.indexOf('OS/8')!=-1||ua.indexOf('OS 8')!=-1)&&(ua.indexOf('Safari')==-1)){ 
function IOS_SCROLL_BOOTSTRAP() { 
var children = Array.prototype.slice.call(document.body.children), 
placeholder = document.createElement('section'), 
fragment = document.createDocumentFragment(), 
styles, 
width, 
height; 
children.forEach(function(c){fragment.appendChild(c);}); 
placeholder.appendChild(fragment); 
styles = [ 
'width:100%;', 
'height:', (window.screen.height - 42), 'px;', 
'position: absolute; overflow: auto; -webkit-overflow-scrolling: touch' 
].join(''); 
placeholder.style.cssText = styles; 
document.body.appendChild(placeholder); 
} 
window.addEventListener('load', function (e) { 
IOS_SCROLL_BOOTSTRAP(); 
}); 
}

For easy access, I've set this up via a bitly/heroku: https://bit.ly/vf_ios8_fix

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.