0

I have basic example of submitting a value to a hidden. But its seems not to want to take my value in my function. Maybe there us something am missing.

<script language="JavaScript">
function submitForm() {
document.statusform.do.value = "checkstatus";
document.statusform.submit();
}
</script>

<form action="" method="GET" enctype="multipart/form-data" id="statusform">
<input type="hidden" name="do" id="do" value="">
<input type="submit" class="button" name="submit" value="Resume Request" onClick="submitForm();" /></form>
1
  • Don't use 'do' as name, because it a keyword Commented Mar 24, 2013 at 7:52

2 Answers 2

1

First, You're wrong in this part:

document.statusform.do.value = "checkstatus";
document.statusform.submit();

In firefox error console it will be show an error:

Error: TypeError: document.statusform is undefined

Change that code to:

document.forms['statusform'].do.value = "checkstatus";
document.forms['statusform'].submit();

Second, remove name attribute from submit button.

Change this part:

<input type="submit" class="button" name="submit" value="Resume Request" onClick="submitForm();" /></form>

to:

<input type="submit" class="button" value="Resume Request" onClick="submitForm();" /></form>
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you Iswanto San. Is there a way to store a image hotspot selection to a variable to passed on later in a GET method?
@saiyan101: you can put the value in hidden field
I have done that but to no success. this is in my map tags: <area shape="poly" coords="472,242,455,234,448,223,460,213,480,197,493,184,504,191,489,231" href="results.php" onclick="alert('<?php echo $_SESSION['map']="NYC"; ?>');submitForm('<?php echo "NYC"; ?>');" />
0

change

<form action="" method="GET" enctype="multipart/form-data" id="statusform">

to

<form action="" method="GET" enctype="multipart/form-data" name="statusform">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.