/    Sign up×
Community /Pin to ProfileBookmark

Disappering Login Form

Hello,

Not sure if this JavaScript, but I am wondering how to let the login form and button disappear and have a text like: Welcome, you are now logged in shown instead.

I hope you understand me, it’s a LOT clearer inside my head ?

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@drudekenAug 20.2010 — Please give some details on your implementation.

Is your login using AJAX to validate login?

Is your login posting to another page? The same page?

What are you using to generate the page on the server? php,jsp...etc.

The web world is so large, you need to give more details if you expect answers. ?
Copy linkTweet thisAlerts:
@crabapplesauthorAug 20.2010 — I am using PHP to send information to a mySql database.

Also i'm very new to JavaScript, and pretty new, but not noob at PHP.

I just wanted to know what I should use, how hard it is, etc. to let that login form disappear, so I can work on that later. ?

Crabapples
Copy linkTweet thisAlerts:
@crabapplesauthorAug 21.2010 — Did some googling, and tried something like this:

[CODE]<head>

<script language="JavaScript" type="text/javascript">
function loginChange(){
document.getElementById(loginForm).visibility = "hidden";
}
</script>
</head>
<body>

<form id="loginForm" method="POST" action="#">
<input type="text" /><br />
<input type="password" /><br />
<input type="submit" onClick="loginChange()" />
[/CODE]


But that didn't work for hiding the form. I'm probably doing something wrong.

Some help would be very appreciated.
Copy linkTweet thisAlerts:
@FangAug 21.2010 — document.getElementById([COLOR="Blue"]"[/COLOR]loginForm[COLOR="Blue"]"[/COLOR]).[COLOR="Blue"]style.[/COLOR]visibility = "hidden";
// or
document.getElementById("loginForm").style.display = "none";

and prevent page reload&lt;input type="submit" onclick="loginChange(); [COLOR="Blue"]return false;[/COLOR]" /&gt;
Copy linkTweet thisAlerts:
@crabapplesauthorAug 21.2010 — Nope, Doesn't work.

With prevent page reload piece still doesn't work.

EDIT: NEVER MIND. Did something wrong and it works.

Thank you alot Fang.

Or as we say in dutch: Hartelijk bedankt ?
Copy linkTweet thisAlerts:
@FangAug 21.2010 — &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;&lt;/title&gt;
&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
function loginChange(){
document.getElementById("loginForm").style.visibility = "hidden";
}
//]]&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h3&gt;form start&lt;/h3&gt;
&lt;form id="loginForm" method="post" action="#"&gt;
&lt;div&gt;
&lt;input type="text" /&gt;&lt;br /&gt;
&lt;input type="password" /&gt;&lt;br /&gt;
&lt;input type="submit" onclick="loginChange(); return false;" /&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;h3&gt;form end&lt;/h3&gt;
&lt;/body&gt;
&lt;/html&gt;
×

Success!

Help @crabapples spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...