Home Ask Login Register

Developers Planet

Your answer is one click away!

Serg Shapoval February 2016

Relocate user to Registration page if login inputs are empty. JavaScript

I have got login page. There are two inputs - login and password. I need a Script like if user press Login button and my two inputs(login and password) are empty it will relocate user to registration page. Its url is http://localhost:8080/app/login and i need to redirect to this URL http://localhost:8080/app/registration. This is my Login page

    <%@ page language="java" contentType="text/html; charset=UTF-8"
<?xml version="1.0" encoding="UTF-8"?>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html>
<title>Войти в систему | Haine and Vold</title>
 <link rel="shortcut icon" href="<c:url value="/resources/faviicon/iconHV.ico"/>" type="image/x-icon">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="<c:url value="/resources/bootstrap/bootstrap.css"/>"
    rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/CSS/styles.css"/>" rel="stylesheet"
<script src="<c:url value="/resources/Angular/angular.min.js"/>"></script>


<span class="text-center">
        <span class="rusLogo"><a href="?locale=ru"><img
                src="<c:url value="/resources/languageicons/rus.png"/>"
                alt="Russian Language" title="Сменить язык интерфейса на русский"></a>
                <a href="?locale=en"><img
        src="<c:url value="/resources/languageicons/usa.png"/>"


coolk February 2016

    if($('#username').val().trim().length == 0 && $('#password').val().trim().length == 0){
        window.location.href = '/app/registration'

Post Status

Asked in February 2016
Viewed 2,123 times
Voted 13
Answered 1 times


Leave an answer

Quote of the day: live life