/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] How do I make assign a button an ordinary link?

I want to use a button from a form and assign it a link.
How do I do this?
(I actually want to assign it javascript(-1)).

Thanks.

OM

to post a comment
HTML

10 Comments(s)

Copy linkTweet thisAlerts:
@datapunk79Jul 26.2008 — I'm not sure what you're asking for but...

You can assign a action to a form to have it do something or go somewhere depending on what you want the form to do.

If you want to put a link on it then you can assign the form action to that link url. (But you may want to rethink this idea because its a lot of coding that you don't really need.)
[code=html]
<form id="name-of-your-form" action="http://your-first-link-url" method="post">
<input type="submit" value="Your Button Name">
</form>
[/code]


You said you want to link it to javascript. I don't know that that means but..

You can assign javascript to do something during certain occasions. Like when the button is clicked, or the form is submitted, or the text in a field has changed.
Copy linkTweet thisAlerts:
@OM2authorJul 26.2008 — thanks for the reply.

i was trying to say, i want the link to be [SIZE=4]"javascript:history.go(-1)"



question: can i have a form inside a form?



thanks.

[/SIZE]
Copy linkTweet thisAlerts:
@CentauriJul 26.2008 — You mean something like :[CODE]<input name="Back" type="button" value="Go Back" onClick="javascript:history.go(-1)">[/CODE]
Copy linkTweet thisAlerts:
@OM2authorJul 26.2008 — You mean something like :&lt;input name="Back" type="button" value="Go Back" onClick="javascript:history.go(-1)"&gt;[/quote]

exactly what i wanted. ?

thanks.
Copy linkTweet thisAlerts:
@datapunk79Jul 26.2008 — question: can i have a form inside a form?[/QUOTE]

Yes, no and maybe. It's possible in HTML, not in XHTML. But you could probably write a PHP or server side script to determine which submit button was clicked. All in all, I would avoid nesting forms if possible.
Copy linkTweet thisAlerts:
@OM2authorJul 26.2008 — Yes, no and maybe. It's possible in HTML, not in XHTML. But you could probably write a PHP or server side script to determine which submit button was clicked. All in all, I would avoid nesting forms if possible.[/quote]
thanks for the reply.

i would have done this otherwise!
Copy linkTweet thisAlerts:
@datapunk79Jul 26.2008 — Great, please mark thread as resolved if you don't have any else further.
Copy linkTweet thisAlerts:
@ray326Jul 26.2008 — Actually forms cannot contain other forms.
Copy linkTweet thisAlerts:
@datapunk79Jul 26.2008 — Actually forms cannot contain other forms.[/QUOTE]

Check this out.
Copy linkTweet thisAlerts:
@ray326Jul 28.2008 — From the article:When the new form was created, the HTML validator became a bit upset about the fact that a new form was created within an existing form. This isn&#8217;t allowed.[/QUOTE]
×

Success!

Help @OM2 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.18,
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,
)...