1

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>
2
  • why can't you submit the form and return the answer (link or text) according to that? Commented Mar 5, 2014 at 15:26
  • I am very beginner in Rails, how can I do that? Commented Mar 5, 2014 at 15:27

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.