So I'm using the jQuery plugin, RSV(real simple validation) because the client would like to use alert boxes as opposed to inline alerts for the form validation. This site is for mobile browsers. The problem I'm running into is that when there's an error, an alert dialogue comes up to tell the user about t开发者_运维知识库heir offense. When the alert is closed, the offending field is focused. The problem with the android is that the soft keyboard doesn't show up. Here's the code that generates the error handling:
function timsErrorFunction(f, errorInfo)
{
for (var i=0; i<errorInfo.length; i++)
{
// errorInfo[i][1] contains the error string to display for this failed field, e.g.
alert(errorInfo[i][1]);
// errorInfo[i][0] contains the form field node that just failed the validation, e.g.
errorInfo[i][0].focus();
errorInfo[i][0].style.color = "red";
}
return false; // always return false! Otherwise the form will be submitted
}
I am not familiar with Web application for Android. and I don't see the context(RSV declarations, rules, oncomplete handlers) for this problem.
However, I think you are not using RSV correctly. I mean, when validation failed, you should not manually make the field focused, this work will be done by RSV automatically.
You should just return an array instead of "false".(see this link for more details: rsv validation by Benjamin Keen own function doesn't work properly? )
精彩评论