I have JavaScripts variables which I got as username and password, I want to check them out if they are okay then show me a new link or new page if not then show me a text.
!DOCTYPE html>
<html>
<head>
<script>
function validateForm()
{
var x=document.forms["myForm"]["fname"].value;
}
if (x == "n/a_17")
{
window.location="http://cmpt470.csil.sfu.ca:8017/welcome/index ";
}
</script>
</head>
<body>
<form name="myForm" action="demo_form.asp" onsubmit="return validateF$
User Name: <input type="text" name="username">
Password: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
<% if x == "n/a_17 -%>
password is correct
<a href="/posts/new"> posts </a>
<% end -%>
</body>
</html>
From your comments, if you're only trying to do an authentication form with Rails, you should check out first the Rails Tutorial , Chapter 7 is about building an authentication form.
You might also want to check the Rails Guides .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.