i have a problem with my form. there are 2 button : a login and a register button . login but will redirect to welcome.php, register to register.php. i put the action in the form like this
<form name="login" method="post" action="welcome.php" >
the problem is both buttons turn me to welcome.php, how can i solve this ? thanks alot

You must close each form with </form> and make sure that one form is not within another.


Matti Ressler
Suomedia

<html>
<body>
<form method="post" name="test">
<input type="button" name="button1" value="login" onClick="javascript: 

document.test.action='login.php';document.test.submit();"><input type="button" name="button2" value="Register" 

onClick="javascript: document.test.action='register.php';document.test.submit();">
</form>
</body>
</html>

You can do it this way.

And if the user has javascript turned off? Nothing happens, not good.

Your are far better to structure you page in such a way as to not depend on javascript.

Most login/register pages have form inputs for username and password for registered members, and a simple linked button to the registration page if the user is not registered:

<html>
<body>
<form method="post" name="test" action='welcome.php';>
<input type="submit" name="button1" value="login"><a href="register.php"><input type="button" name="button2" value="Register"></a>
</form>
</body>
</html>

Matti Ressler
Suomedia

If javascript is disabled, even the form validation/ajax wouldn't work. :)

What Ajax? A well written script will function without either javascript or Ajax. A good example: http://holyculturedownload.com/

This is a heavily Ajaxed site. Turn off javascript and it is still functional - this allows it to have Google results like this and for users to still browse the site.

A form should not rely only on javascript for validation - the PHP side should also check the $_POST data.


Matti Ressler
Suomedia

What Ajax? A well written script will function without either javascript or Ajax. A good example: http://holyculturedownload.com/

That unfortunately, didn't work in FF2 when I disabled javascript. Click on the "Listen" button to test. Strangely, even gmail's "send" button didn't work when I disabled javascript.

A form should not rely only on javascript for validation - the PHP side should also check the $_POST data.

Yes, ofcourse.

That unfortunately, didn't work in FF2 when I disabled javascript. Click on the "Listen" button to test. Strangely, even gmail's "send" button didn't work when I disabled javascript.

Now that is pedantic... the "listen" button is clearly a javascript/Ajax control. The point was that the SITE functions without javascript for the purpose of search engine indexing (which it does very well).... I dont believe that Googlebot listens to music :icon_lol:

I think you will find that the signup page functions quite fine without Javascript (it does have it).


Similarly, forms should be designed not to be dependent on Javascript to accomplish their purpose. That Gmail fails for something so fundamental is surprising, but not acceptable.


Matti Ressler
Suomedia

The point was that the SITE functions without javascript for the purpose of search engine indexing (which it does very well).... I dont believe that Googlebot listens to music

Nope. That wasn't the point. The point was,

And if the user has javascript turned off? Nothing happens, not good.

What Ajax? A well written script will function without either javascript or Ajax. A good example: http://holyculturedownload.com/

.
But the bottomline is, if javascript is disabled, many options in the site holyculturedownload doesn't work.
FYI,

JavaScript must be enabled in order for you to use Gmail in standard view. However, it seems JavaScript is either disabled or not supported by your browser. To use standard view, enable JavaScript by changing your browser options, then try again.

Nope. That wasn't the point. The point was, .
But the bottomline is, if javascript is disabled, many options in the site holyculturedownload doesn't work.
FYI,

Clearly you have a bee in your bonnet. So, you find that javascript controls dont work on a site when javascript is turned off? Congratulations, perhaps you learned something?

Now look at the POINT of the example, and you will see that content previously loaded with Ajax still loads and the site can be browsed normally - the point there was that this is vital for search engines, not for users who KNOW they cannot disable javascript on such a site and expect to enjoy the rich features. Your "bottomline" is totally mindless. Perhaps you can code something close to its standard? I think not.

I know exactly what my first point was - that if javascript is turned off in a FORM for user input and it does not function, then that is not good (your form example). Try the form on holyculturedownload.com and tell me that it doesn't work, both with and without javascript - THAT is how forms should work.


Matti Ressler
Suomedia

Clearly you have a bee in your bonnet. So, you find that javascript controls dont work on a site when javascript is turned off? Congratulations, perhaps you learned something?

Unfortunately, I didn't learn anything (well, because there is nothing to learn from that.) But the answer for

So, you find that javascript controls dont work on a site when javascript is turned off?

is, Yes. With javascript turned off, some features of the site doesn't work.

the point there was that this is vital for search engines,

I never mentioned any search engine. The OP had a question and I just answered.

not for users who KNOW they cannot disable javascript on such a site and expect to enjoy the rich features.

if the user has javascript turned off? Nothing happens, not good.

I know exactly what my first point was - that if javascript is turned off in a FORM for user input and it does not function, then that is not good (your form example).

Again, how can one turn off javascript IN a form and not the whole page. (From the end user's POV.)

Try the form on holyculturedownload.com and tell me that it doesn't work, both with and without javascript - THAT is how forms should work.

I had enough of that stupid site. And the enduser can't "turn off" javascript for a form. If he turns it off, he turns it off for the whole page.

Cheers,
Naveen


if the user has javascript turned off? Nothing happens, not good.

There, by your own hand. Your "solution" was a very bad one.

As for your bagging of holyculturedownload.com, I believe that is jealousy pure and simple :icon_lol:


Matti Ressler
Suomedia

There, by your own hand. Your "solution" was a very bad one.

Damn. This is so bad. You didn't get the feeling of sarcasm from that.

As for your bagging of holyculturedownload.com, I believe that is jealousy pure and simple

ROFLMAO. Jealous of what ? That website ? :twisted: Wow man ! You have some "nice" imagination.

Damn. This is so bad. You didn't get the feeling of sarcasm from that.

You are sarcastic about the reality of how bad your solution is? Now THAT is funny :icon_cheesygrin:

You spend so much time bagging a site because non essential javascript controls don't work when javascript is turned off in a user's browser (surprise, surprise!), yet cant see the reality of how bad it is to code an ESSENTIAL feature that is totally dependent on javascript..... the ONLY point you have proved is how BAD our solution is.

Yes, you are quite clearly jealous... that is even funnier :icon_lol:

You are sarcastic about the reality of how bad your solution is? Now THAT is funny :icon_cheesygrin:

:twisted: Nope ! I was sarcastic about your first statement.

if the user has javascript turned off? Nothing happens, not good.

duh!

You spend so much time bagging a site because non essential javascript controls don't work when javascript is turned off in a user's browser (surprise, surprise!),

A user can't turn off javascript for a FORM (More surprise !!!).

yet cant see the reality of how bad it is to code an ESSENTIAL feature that is totally dependent on javascript.....

I thought the "LISTEN" button was an ESSENTIAL feature of that stupid site !

the ONLY point you have proved is how BAD our solution is.

:icon_rolleyes: Yeah, asking the user to have a hyperlink instead of what he asked for(ie., a button), is a VERY GOOD solution!

Yes, you are quite clearly jealous... that is even funnier :icon_lol:

Give me one good reason why I should jealous of one crappy site ? ;) If a site can make someone jealous, then oh yeah, I am jealous of yahoo, msn, google, and oh, daniweb as well ! LMAO.

:twisted: Nope ! I was sarcastic about your first statement. duh!

Why be sarcastic about something that is quite clearly correct? You try to make a point that non essential things like "listen" buttons not working are "bad", yet cant see how ridiculous it is to create a form that wont function without javascript. DUH!!!!!

A user can't turn off javascript for a FORM (More surprise !!!).

Oh really? Paste your own code into a file, open it in your browser with javascript turned off. Then tell me that it still works :icon_lol: SURPRISE!!!!!..... it doesn't. Yes, a user CAN turn off javascript for your form.

I thought the "LISTEN" button was an ESSENTIAL feature of that stupid site !

You thought wrong (as you do about many things). I think you will find that you can still, browse the site, create an account, purchase music and any other essential thing with javascript turned off. The essential things all work just fine. That you like to call it "stupid" only indicates your own insecurity.

:icon_rolleyes: Yeah, asking the user to have a hyperlink instead of what he asked for(ie., a button), is a VERY GOOD solution!

Oh gee.... I think you better look again:

<html>
<body>
<form method="post" name="test" action='welcome.php';>
<input type="submit" name="button1" value="login"><a href="register.php"><input type="button" name="button2" value="Register"></a>
</form>
</body>
</html>

I don't know about you, but I definitely see two buttons :icon_rolleyes:

Give me one good reason why I should jealous of one crappy site ? ;) If a site can make someone jealous, then oh yeah, I am jealous of yahoo, msn, google, and oh, daniweb as well ! LMAO.

You probably are. One good reason? Ok, you wouldn't have a clue how to make anything close to it.


Matti Ressler
Suomedia

Why be sarcastic about something that is quite clearly correct?

Quite clearly correct ? :icon_lol: setting the action of a form when a button is clicked is correct as well. Just like how "some" features of a stupid site doesn't work when javascript is turned off, a form which uses javascript to assign the action, wouldn't work.

You try to make a point that non essential things like "listen" buttons not working are "bad", yet cant see how ridiculous it is to create a form that wont function without javascript. DUH!!!!!

Thats exactly my point. If you "Turn off" javascript, anything dependent on javascript will fail.

Oh really? Paste your own code into a file, open it in your browser with javascript turned off. Then tell me that it still works :icon_lol: SURPRISE!!!!!..... it doesn't.

As I have already said umm.. more than 10 times, anything DEPENDENT on javascript WILL NOT work if javascript is turned off. Eg.

JavaScript must be enabled in order for you to use Gmail in standard view. However, it seems JavaScript is either disabled or not supported by your browser. To use standard view, enable JavaScript by changing your browser options, then try again.
To use Gmail's basic HTML view, which does not require JavaScript, click here.
If you want to view Gmail on a mobile phone or similar device click here.

Yes, a user CAN turn off javascript for your form.

Wow ! Is that so ? A user can turn off javascript ONLY for a form and not for the whole page ! Hmmm.. you know something that others dont ! *wink wink*

You thought wrong (as you do about many things). I think you will find that you can still, browse the site, create an account, purchase music and any other essential thing with javascript turned off. The essential things all work just fine.

Lol..But still some things wouldn't work. Oh, I noticed something.. Even Daniweb's smiley dropdown, undo, redo wouldn't work if I turn off javascript :( ! Sad, Isn't it ?

That you like to call it "stupid" only indicates your own insecurity.

Wow! Insecurity ! You will steal my job ! :S LOL..

You probably are. One good reason? Ok, you wouldn't have a clue how to make anything close to it.

I just noticed its a site done by you/your company ! awww! you poor thing ! If my words hurt your feelings, I am sorry ! :twisted:

Quite clearly correct ? :icon_lol: setting the action of a form when a button is clicked is correct as well. Just like how "some" features of a stupid site doesn't work when javascript is turned off, a form which uses javascript to assign the action, wouldn't work.

Thats exactly my point. If you "Turn off" javascript, anything dependent on javascript will fail.

Setting the action of a form using javascript is idiotic. That was my point, not yours. That I pointed it out has caused you to continue trolling like this ever since.

Wow ! Is that so ? A user can turn off javascript ONLY for a form and not for the whole page ! Hmmm.. you know something that others dont ! wink wink

This is typical of your trolling - you try to take something somebody has written and make something different from it - bravo! If you insist on putting it that way (which I never said) then yes, it can be done.... you think about it.

Lol..But still some things wouldn't work. Oh, I noticed something.. Even Daniweb's smiley dropdown, undo, redo wouldn't work if I turn off javascript :( ! Sad, Isn't it ?

Yes, its very sad that you cannot see the difference between smileys and a login form. One is essential, the other not.

Wow! Insecurity ! You will steal my job ! :S LOL..

Do you actually have a job??

I just noticed its a site done by you/your company ! awww! you poor thing ! If my words hurt your feelings, I am sorry ! :twisted:

My feeling are not touched in the slightest by forum trolls. I think it is you who feels offended because I pointed out the idiocy of your form.

You forgot about the allegedly missing buttons... are they there or not? In fact, are not most login forms you will find on the web designed in a similar way? Does not my own example on holyculture function perfectly both with and without javascript?

You cannot win.

Matti Ressler
Suomedia

Edited 3 Years Ago by Reverend Jim: Fixed formatting

Setting the action of a form using javascript is idiotic. That was my point, not yours. That I pointed it out has caused you to continue trolling like this ever since.

LOL..

A well written script will function without either javascript or Ajax. A good example: stupid_site snipped

This is typical of your trolling - you try to take something somebody has written and make something different from it - bravo! If you insist on putting it that way (which I never said) then yes, it can be done.... you think about it.

LOL again ! I "try" to take "something" "somebody" has written and make "something" different from it. I take something somebody has written and make something different from it(I never said that anyway!). But I dont steal others code (like you!).

Yes, its very sad that you cannot see the difference between smileys and a login form. One is essential, the other not.

Stupidity has no boundary. The point that I made was

If javascript is disabled, even the form validation/ajax wouldn't work.

and the reply that I get is,

What Ajax? A well written script will function without either javascript or Ajax. A good example: stupid_site_snipped

You contradicted your own statement by saying

Yes, its very sad that you cannot see the difference between smileys and a login form. One is essential, the other not.

which means, you agree that some features DOESN'T work when javascript is turned off.

Do you actually have a job??

LOL..No..Dutch govt is paying me for browing the internet.

My feeling are not touched in the slightest by forum trolls. I think it is you who feels offended because I pointed out the idiocy of your form.

Ah cmon now! I can clearly see I have hurt your feelings. Stand infront of the mirror and see the troll crying back at you !

You cannot win.

LOL..I don't have to win, because I have already won.

Thanks for the series of jokes.. My day was never this better !

LOL..
But I dont steal others code (like you!).

Now you have overstepped all boundaries of decency.

Please backup your accusation or make an unreserved apology.


Matti Ressler
Suomedia

you try to take something somebody has written and make something different from it -

Now you have overstepped all boundaries of decency.

Please backup your accusation or make an unreserved apology.

echo!

This question has already been answered. Start a new discussion instead.