Closed Thread Icon

Preserved Topic: submit (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=20562" title="Pages that link to Preserved Topic: submit (Page 1 of 1)" rel="nofollow" >Preserved Topic: submit <span class="small">(Page 1 of 1)</span>\

 
Troxeye
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Jul 2002

posted posted 08-29-2002 11:27

is it possible to make a form-submit using a normal link? Or is it possible to make a submitbutton to look like a normal link?

-- Färdig-färdig. FÄLL! --

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 08-29-2002 13:31

Yes, you can do that - but it requires a bit of JavaScript which means that only visitors who didn't disable it may submit the form. But I suppose you won't meet many of them and apart from that their Enter button should still submit it.

So here's the code for the link:

<a href="javascript:document.forms[0].submit();">SUBMIT</a>

Clicking it submits the first form on the page. If you have more than one, you can also add a name attribute to the form tag and call it with document.forms["name-of-the-form"].

kuckus (cell #282)

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-29-2002 17:53

Or document.forms.name_of_the_form, since the two are equivalent.

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 08-30-2002 15:13

Small point to add here: (but you all know this already)

kuckus: "their Enter button should still submit it" - an interesting point, however...

If you program the form so that <input name="Submit" type="button" value="Submit"> pressing enter will NOT submit the form.
Useful if you have large text-boxes where the user is likely to hit [Enter] to add a linebreak in their text.


Everything I know about people, I learned from pens.
Cell number: 698

Troxeye
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Jul 2002

posted posted 09-02-2002 08:38

Thx... But I can't make it work...

As long as I have ....document.forms[0].subm... itworks great,
but when I insert an ASP variable (....document.forms[<% =cou %>].subm...) or anything else
I will get an error telling me "document.forms.X is null or not an object"

Is there a way to set a "value=" and "name=" on the submit-link in the JS code?

Troxeye
Royal Swedish Navy

-- Färdig-färdig. FÄLL! --

[This message has been edited by Troxeye (edited 09-02-2002).]

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 09-02-2002 14:21

Does the variable contain a number or a string? If it's a string, you'll have to put quotes around it, like ["name_of_my_form"]. Or try doing it the way Slime suggested.

Anyway it might help to see the code you're working with.

As for the name and value attributes, you could add a conventional submit button with these attributes and hide it via CSS (style="display: none;"). The variable should then be sent to the script when the visitor clicks the JS link.

kuckus (cell #282)

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 09-02-2002 18:07

Dufty: Even when <input type="submit" ... > is used, pressing enter in a multi-line text box won't submit the form. Pressing enter with any other type of form control in focus, however, will.

« BackwardsOnwards »

Show Forum Drop Down Menu