I have a small problem for you

Outline :

I have a specific application that I wish to use javascripting to submit a form. Im not too worried about compatibility less than 4 series browsers.

I wish to submit a form (is going to a database) using a link. A submit button doesnt seem to work for me as I need to also pass hidden variables with the submission to enforce the 'state' of the button pressed.

Say I have 4 links.

a, b, c, d

The page has 2 hidden inputs .

1 = False
2 = True

Pressing link 'a' I want to send an input value of 1 = False, 2 = false

Pressing link 'b' I may want to send an input value of 1 = true, 2 = false etc.

I currently achieve this with :

<a href='#' onClick="
document.FormName.HiddenAction.value='AddNew';
document.FormName.ActionLink.value='True';
this.href='javascript:submitForm()'">Add New</a>

Which submits to this function:

<script type="text/javascript" language="JavaScript">
function submitForm()
{
document.FormName.SubmitName.click();
}
<script>

Now this works fine, BUT I need a named 'Submit' button (SubmitName) for this to work. I dont want that submit button to show.

Another option seemed to be :

<a href='#' onClick="document.FormName.HiddenAction.value='AddNew';
document.FormName.ActionLink.value='True';
document.FormName.submit();">AddNew</a>

It works in IE 5.5, but not others.

What other options are possible for me?


Thanks in advance