No, action="self" means the form will be submitted to a page named "self" in the current directory.
For instance, if your current url is http://www.experts-exchang
The form will be submitted to http://www.experts-exchang
If the page does not exist, then you'll get an error404.
Your form uses javascript and javascript is able to modify the form's action before the data is submitted. This means that your form might work when javascript is enabled even if the "self" page does not exist.
In your case, submitting the form's data is probably not necessary. Your javascript probably checks if the answer is correct on the client side. In that case, the value of the "action" attribute does not matter since the data is never submitted.
For your form not to submit the data, have the form's "onsubmit" return false.
In any case, the code you posted can be improved... you should use the "onsubmit" event of the form element and you should not need to use the onclick event on your input/text element. Also, you should not need to have a <div> AND a <p> as container... that's redundant. And use padding/margin to modify the spacing instead of <br>.
Assuming the answer is checked on the client side, the final code should look like this:
<form id="q1" action="dummy" onsubmit="checkQuestion(th
<p>Score is the measure of a learner's <input type="text" name="answer" maxlength="15" size="15" />.</p>
<input type="reset" name="reset" value="Reset" />
<input type="button" name="submit" value="Submit" />
</form>
The checkQuestion() function should use the DOM to get the content of the "answer" and probably display some message like "nope, that's wrong" or "yes, that's correct".
Main Topics
Browse All Topics





by: aprestoPosted on 2006-07-20 at 08:15:27ID: 17147016
Hi uksub,
i normally use "", but yes, it means it posts to itself, so if the page the form sits in is called "Page1.asp", by using self or "" you are telling the form that the action is Page1.asp
Apresto