views:

77

answers:

4

Any methods to submit a POST request from a link if JS is disabled?

Ideeas so far (none of them perfect)

  1. Use <input type='submit>, but I need a link not a button
  2. Use <a href='' onclick='form.submit()' > but that relies on JS
  3. Use <input type='image'> ... again .. not really a link

I need a fallback method for browsers without JS, and my area for these "buttons" is too small for buttons or images

+1  A: 

Not possible, sorry.

Cory Petosky
+2  A: 

No, there isn't.

Links afford going somewhere. Buttons afford sending data somewhere.

If you want to use a link to make a POST request, then you are either sending confusing signals to users or you have your backend setup to use the wrong type of HTTP request for the task.

David Dorward
Besides your first sentence, most of this is unfortunately no longer true in the "Web 2.0" era. Nowadays people aren't terribly surprised if data gets sent somewhere without a button press at all.
Cory Petosky
I agree that links should just LINK places, but the reality is we use CSS'd links as buttons on a normal everyday use. They tend to look more consistent accross OSs and browsers and we can use better :hover, :disabled,etc states
Radu094
+2  A: 

You could make the button look like a normal link if you want using CSS?

Something like this perhaps?

<style type="text/css" media="screen">
input {
  border: none;
  background: none;
  color: #00f;
  text-decoration: underline;
  cursor: pointer;
  display: in-line;
  margin: 0px;
  padding: 0px;
}
</style>

Click <input type="submit" value="here"/>!

Edit to add: The following CSS is just an example of how it might work, though not thorougly tested and to make it look like one of your normal links you might need to tweak it a bit.

Huppie
A: 

The one solution I can think of is to have a form on the page with a button styled so that it simply looks like a text link.

When Javascript is enabled, you can gracefully hide this form and allow the normal link to take precident and if Javascript is disabled, allow the user to still use the system.

Jamie Dixon