Razvan Dumitru
Razvan Dumitru

Reputation: 12452

A with href being submit form?

Is this secure ?

<form id="form-id">

    <input type='text'name='name'>

    <input type='submit' value='Go' name='Go'/></form> 

    <a href="#" onclick="document.getElementById('form-id').submit();">submit</a>

If not, is there any other way to achieve same behaviour ?

Upvotes: 0

Views: 224

Answers (1)

Quentin
Quentin

Reputation: 943569

You aren't taking in any more or less user input (either at the browser or at the server) then you are with a regular submit button, so that approach doesn't impact security at all.

It does add a completely unnecessary dependancy on JavaScript and puts responsibility for submitting the form on a control not designed for submitting forms (and which won't show up in the Forms Mode of many screen reader software packages) so you shouldn't do that, just not for reasons related to security.

is there any other way to achieve same behaviour ?

Yes, and you have it already:

<input type='submit' value='Go' name='Go'/>

Upvotes: 2

Related Questions