This topic is locked

Jscritp Button not working on Iphone but works on everything else

4/28/2020 8:53:40 PM
PHPRunner General questions
M
Mark Kramer author

I have a "Clock Out" buton that sets when the user clicks it, it clock out time and figures total hours. It works great on windows browsers, linux, android, etc. But not on Iphones. I've tried Opera and Safari with no luck

below is the code that works everything else..... Ant thoughts ... Yes Jscript is turned on on the Iphone browsers under settings.. Thanks in advance <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=27347&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />
var d = new Date();

var ctrlDate = Runner.getControl(pageid,'TimeOut');

ctrlDate.setValue(d);
var CD = Runner.getControl(pageid,'TimeIn');

var DO = new Date(CD.getValue());

var DOP = Date.parse(DO)

var dp = Date.parse(d)

var TT =Runner.getControl(pageid,'Totaltime');

var cl = Runner.getControl(pageid,'closed');

// get total seconds between the times

var delta = Math.abs(dp - DOP) / 1000;
// calculate (and subtract) whole days

var days = Math.floor(delta / 86400);

delta -= days 86400;
// calculate (and subtract) whole hours

var hours = Math.floor(delta / 3600) % 24;

delta -= hours
3600;
// calculate (and subtract) whole minutes

var minutes = Math.floor(delta / 60) % 60;

delta -= minutes * 60;
// what's left is seconds

var seconds = delta % 60;

//tto =(days)+" day(s) "+(hours)+" hr(s) "+(minutes)+" min "+(seconds)+" sec "

tto =(hours)+" hr(s)"+(minutes)+" min "
TT.setValue(tto);

cl.setValue(1);
//("#saveButton12").click(); //emulate save button

pageObj.getItemButton('edit_save').click();

self.location.href = window.location
return false;

M
MikeT 4/29/2020

I have some blurry memories about jquery and click events not working in iOS. I'd check stack overflow, maybe you'll have to resort to resort to some custom css/jscript as a workaround.

M
Mark Kramer author 4/29/2020



I have some blurry memories about jquery and click events not working in iOS. I'd check stack overflow, maybe you'll have to resort to resort to some custom css/jscript as a workaround.


Thank you . I vaguely remember reading something about it too. One would think it would have been fixed in iOS by now. Oh well such is life, I will take a look at stack overflow and see what I can find. It's a pretty simple script that calculates hours work .. "It's not Rocket Appliance Julian" as Ricky in Trailer park boys would say. LOL
Thanks again for the suggestion.