Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: onKeyup difficulties with iPad on v2.05

onKeyup difficulties with iPad on v2.05 7 Monate 1 Tag her #107871

  • ohvelma
  • ohvelmas Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 1
To those with success on iPad's in version 2.05 ... HELP!!! :(

I am using double authentication for surveys.
The user needs a token to get to the survey, per usual.
I use JavaScript to hide the "Next" button when the page with the first question loads.
I also use JavaScript/jQuery to set up a keyup event to call a custom handlekeypress() function.
The first survey question prompts the user to enter a second token into a short text question.
On each keystroke into the question the handlekeypress() funciton is called checking for a match between the token field attribute_1 (token2) and the entered text.
On a match the handlekeypress() function enables the "Next" key and the user can continue on the survey.

In my previous survey in 1.92 this all works great in IE, Mozilla, and Safari on the iPad.

However I am having some difficulty on the Safari browser on an iPad, I don't seem to be able to trigger a keyup event from the touch screen.

I have tried, keyup, keydown, keypress, and change events trying to capture the entry of text, but to no avail. I am pretty sure it is possible ... I just haven't found the magic formula.

I am thinking that this may be because in 2.05 the onkeyup() function for text boxes is already calling the checkconditions() function.

I am going to try dropping the checkconditions() function from the short text answer and then revising the custom handlekeypress() function to call checkconditions() a match is found (no point if the second token is wrong.)

BTW: It is working using just keyup on IE and Mozilla but sadly failing on the iPad ... which is of course where we will delivering it in our waiting room!
Letzte Änderung: 7 Monate 1 Tag her von ohvelma.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

onKeyup difficulties with iPad on v2.05 7 Monate 1 Tag her #107876

  • holch
  • holchs Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 2952
  • Dank erhalten: 378
  • Karma: 124
How about installing a different browser on the ipad? Wouldn't that be a possibity? I don't know if Apple allows you to install Chrome, Opera or Firefox...
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: ohvelma

onKeyup difficulties with iPad on v2.05 7 Monate 1 Tag her #107878

  • ohvelma
  • ohvelmas Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 1
I thought of that, but there are occasions when subjects complete our surveys from home like if they don't have enough time to complete while at their appointment. In that case they could be using an iPad or mobile device, so I felt I needed to thoroughly address the issue.

What I think I am going to do is use jQuery on page load to drop the "onkeyup=checkconditions()" property from the control and then my event code should work. Since I know that the checkconditions code isn't going to do much for this particular question, my requirement that it match the attribute_1 token field is more stringent anyway and it's the only question on the page.

I am thinking that doing that should clear up the issue with the event not firing.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

onKeyup difficulties with iPad on v2.05 7 Monate 11 Stunden her #107888

  • tpartner
  • tpartners Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 4362
  • Dank erhalten: 827
  • Karma: 381
I haven't had time to investigate your keyup problem but how about using JavaScript to, if iPad (or touch device) is detected, insert a "Go" button that can be used to trigger your token-check function?


.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

onKeyup difficulties with iPad on v2.05 7 Monate 7 Stunden her #107911

  • ohvelma
  • ohvelmas Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 1
I don't think my solution is particularly elegant but I got the iPad to work correctly by adding the code below to the template.js. I need to do some further testing to make sure that text controls are still getting properly validated. If that fails I will need to strip the checkcondition() from the onkeyup for the specific question, less elegant, but gets the job done, so a work in progress.
/************************************************************/
function handleKeyPress (currval, currname, currtype){
 
    /************************************************************
    /* Custom validation
    /************************************************************/
    if($('token2').length > 0) {
	validateToken2();
    }
 
    /************************************************************
    /* Call default behavior
    /************************************************************/
    checkconditions(currval, currname, currtype);
 
}
 
$(document).ready(function(){
 
    /************************************************************
    /* Remove checkconditions for ALL text box controls
    /************************************************************/
    $("input.text ").each(function(){
        $(this).remove('onkeyup');
    });
 
    /************************************************************
    /* add in an event for the text box keyup
    /************************************************************/
    $('.text ').keyup(function(){
        var currval = $(this).attr('value');
        var currname = $(this).attr('name');
        var currtype = $(this).attr('type');
        handleKeyPress(currval,currname,currtype);
    });
 
});
Letzte Änderung: 7 Monate 6 Stunden her von ohvelma.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

onKeyup difficulties with iPad on v2.05 7 Monate 3 Stunden her #107919

  • ohvelma
  • ohvelmas Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 1
This wasn't working like I had thought. So I reworked it. In the end simple is always better. I think this solution works fairly elegantly. :)
/************************************************************/
function handleKeyPress (ctrl, e){ // Inserted Tag Actions
 
    var currval = $(ctrl).attr('value');
    var currname = $(ctrl).attr('name');
    var currtype = $(ctrl).attr('type');
    var needtocheck = e==="onkeyup"; // we only override "onkeyup" events
 
    // validate Lime Id
    if($('idcheck').length > 0) {
        validateToken2();
        needtocheck = true;
    }
 
    if ( needtocheck ) {
        checkconditions(currval, currname, currtype, e); // invoke default text box checkconditions
    }
 
}
 
/************************************************************/
$(document).ready(function(){
 
    /************************************************************
    EVENTS 
    /************************************************************/
    $('.text ').keyup(function(){
        handleKeyPress(this,'onkeyup');
    });
 
});
Letzte Änderung: 7 Monate 2 Stunden her von ohvelma.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.250 Sekunden
Donation Image