为什么 IOS 7.0.3 选择器会搞砸我的 LiveCode 网络表单


我不知道

问这个问题的最佳地点在哪里。我的问题似乎与IOS 7.0.3以及Safari如何处理Web表单中的选择器有关。我用LiveCode创建了一个网络表单,在我尝试过的每个浏览器中都能正常工作。但是在iPhone上,选择器出现故障。如果您选择一个项目并按完成,它将恢复为已选择的 0 个项目。如果选择两个项目并按完成,则会显示已选择的一个项目。三、四等也是如此。还有其他人有过这样的经历吗?下面是其中一个多项选择按钮的片段。

<label for="authors[]">
Select Author(s)
  <select name="authors[]" id="authors" multiple="yes" size="7" >
<?lc
    put the number of lines in tAuthorList into tTotalAuthors
    repeat with x = 1 to tTotalAuthors
        put "<option value=" & q(line x of tAuthorList)
        put lineOffset(line x of tAuthorList,tPrevAuthors) into tLineHit
        if bDataSubmitted and line x of tAuthorList is line tLineHit of tPrevAuthors then
            put " selected"
        end if
        put ">" & line x of tAuthorList & "</option>" & return
    end repeat
?>      
  </select>
</label>

这是网址:http://lc.scs.earlham.edu/soul_therapy3.lc

顺便说一下,我在我的Drupal 7站点中将其与iframe一起使用:

http://soulshare.org/soul_therapy/tool

iOS7 中存在一个问题(设计选择?),您不仅需要滚动到正确的值,还需要点击您选择的值。我不知道这是否是你的问题...

在某些表单中,您只需要滚动到正确的值,但在许多情况下,您需要滚动然后选择。正如您可能已经猜到的那样,这与LiveCode无关...

这是IOS中的一个错误,已报告给苹果。目前,我找到的最佳解决方案是jQuery在关闭选取器时修复所选项目。只需将其粘贴到您的JS文件中即可。

// hack for iPhone 7.0.3 multiselects bug
if(navigator.userAgent.match(/iPhone/i)) {
    $('select[multiple]').each(function(){
        var select = $(this).on({
            "focusout": function(){
                var values = select.val() || [];
                setTimeout(function(){
                    select.val(values.length ? values : ['']).change();
                }, 1000);
            }
        });
        var firstOption = '<option value="" disabled="disabled"';
        firstOption += (select.val() || []).length > 0 ? '' : ' selected="selected"';
        firstOption += '>&laquo; Select ' + (select.attr('title') || 'Options') + ' &raquo;';
        firstOption += '</option>';
        select.prepend(firstOption);
    });
}

在 Safari iOS 7 中多选

最新更新