Mi auguro che possa aiutare gli altri. L'ho gestito in javascript. Ho scritto il codice javascript per mostrare il prossimo pulsante sul lato destro di ogni input e selezionare i controlli. Quando l'utente tocca il pulsante successivo, passa al controllo successivo. Ho scritto seguente codice per questo:
//Move to next crontrol bock
var MOVE_TO_NEXT_ID = 'aNext86332';
function bindNext() {
var allTags = document.getElementsByTagName('*');
for (var intEle = 0; intEle < allTags.length; intEle++) {
if (allTags[intEle].tagName.toLowerCase() == 'input' || allTags[intEle].tagName.toLowerCase() == 'textarea' || allTags[intEle].tagName.toLowerCase() == 'select') {
allTags[intEle].addEventListener("focus", function() {
//find next input
var nextFocus = null;
var all = document.getElementsByTagName('*');
var flag = 0;
for (var j = 0 ; j < all.length; j++) {
if (flag == 1) {
if (all[j].tagName.toLowerCase() == 'input' || all[j].tagName.toLowerCase() == 'textarea' || all[j].tagName.toLowerCase() == 'select') {
var t = allTags[j];
try {
if (t.style.display == 'none') {
continue;
}
else if (t.parentElement.style.display == 'none') {
continue;
}
else if (t.parentElement.parentElement.style.display == 'none') {
continue;
}
else if (t.parentElement.parentElement.parentElement.style.display == 'none') {
continue;
}
else {
nextFocus = allTags[j];
break;
}
}
catch (e) { }
}
}
if (this.id == all[j].id) {
flag = 1;
}
}
showNext(this, nextFocus);
});
allTags[intEle].addEventListener("blur", function() {
removeNext(this);
});
}
}
}
function moveToNextControl(me, nextObj) {
if (nextObj != null) {
nextObj.focus();
nextObj.scrollIntoView(true);
}
}
function removeNext(me) {
setTimeout(function() {
try {
var next = document.getElementById(MOVE_TO_NEXT_ID);
me.parentElement.removeChild(next);
}
catch (e) { }
}, 300);
}
function showNext(me, nextObj) {
setTimeout(function() {
var next = document.createElement("a");
next.className = 'btn btn-default animated fadeIn';
next.innerHTML = 'Next';
next.style.position = 'absolute';
next.style.zIndex = 1;
next.style.top = '0';
next.id = MOVE_TO_NEXT_ID;
next.style.left = (me.clientWidth - 40) + 'px';
next.addEventListener("click", function() {
moveToNextControl(me, nextObj);
});
me.parentElement.appendChild(next);
}, 500);
}
//End of Move to next crontrol bock
poi chiamato funzione bindNext come segue:
window.onload = function() {
bindNext();
}
fonte
2017-09-11 19:57:43
ho messo un esempio nella mia interrogazione. – user930141