Hej
Mam sobie formularz do logowania się na strone. Dwa inputy: login i hasło. Chcę, zeby działał na takiej zasadzie:
1. Wypełniasz login klikasz Dalej
2. Pojawia się input z hasłem. Login znika. Pojawia się przycisk "Zaloguj" i "Wróć".
Tyle o ile udało mi się to zakodować, żeby działało poprawnie w wersji mobilnej i "klikanej" na PC to mam problem, bo jak na PC jesteś w polu "login" i nacisniesz enter powoduje to wysłanie nieuzupełnionego formularza zamiast pojawienia się pola "Hasło". Kod wygląda tak:
<http://december.com/html/4/element/form.html action="" data-ajax="true" method="post"> <http://december.com/html/4/element/input.html type="text" name="Login" maxlength="50" autocomplete="off" id="Login"> <http://december.com/html/4/element/input.html type="password" value="" maxlength="26" class="size-200 x-field-1 input-password" id="Password"></http://december.com/html/4/element/input.html> <http://december.com/html/4/element/input.html type="hidden" id="step5" name="step5" value="OK"></http://december.com/html/4/element/input.html> <http://december.com/html/4/element/button.html type="button" id="backbutton" style="display:none;" role="button" aria-disabled="false" onClick="document.getElementById('loginbutton').style.display = 'none';document.getElementById('PasswordLI').style.display = 'none';document.getElementById('LoginLI').style.display = 'block';document.getElementById('nextstepbutton').style.display = 'inline';document.getElementById('backbutton').style.display = 'none';"><http://december.com/html/4/element/span.html class="ui-button-text">Wstecz</http://december.com/html/4/element/span.html></http://december.com/html/4/element/button.html> <http://december.com/html/4/element/button.html type="button" id="nextstepbutton" aria-disabled="false" onClick="document.getElementById('loginbutton').style.display = 'inline';document.getElementById('PasswordLI').style.display = 'block';document.getElementById('LoginLI').style.display = 'none';document.getElementById('nextstepbutton').style.display = 'none';document.getElementById('backbutton').style.display = 'inline';"><http://december.com/html/4/element/span.html class="ui-button-text">Dalej</http://december.com/html/4/element/span.html></http://december.com/html/4/element/button.html> <http://december.com/html/4/element/input.html id="loginbutton" type="submit" style="display:none;" role="button" aria-disabled="false" onClick="document.getElementById('nextstepbutton').style.display = 'none';" value="Zaloguj"></http://december.com/html/4/element/input.html> </http://december.com/html/4/element/form.html>
Po pierwsze rozpisz to na funkcje i do inputow wkladaj wywolanie funkcji a nie zajebisci dlugi JS bo raz ze sie tego ni da czytac a dwa sam sie wkoncu pogubisz
Po drugie, dodaj zdarzenie onkeyup dla inputow i jak ktos kliknie enter to rob co maszrobic i daj return false w ten sposob formularz sie niewysle
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)