Page 1 of 1
Submitting the unsubmittable
Posted: Tue Jun 21, 2005 9:53 pm
by harrison
Hi,
I made a form with a DISABLED CHECKED checkbox, because I detected that the user is not allowed to disagree with that option.
But whenever this form is submitted, it never submit the checkbox. What is this happenning?
If you want me to show the code, I will but I think it is that simple.
Please help me with this.
Posted: Tue Jun 21, 2005 10:39 pm
by method_man
why dont you just make it so that if they dont check it then when they press the submit button it goes to a page that says "you must agree with ..." or somthin like that?
Re: Submitting the unsubmittable
Posted: Wed Jun 22, 2005 12:43 am
by Roja
harrison wrote:Hi,
But whenever this form is submitted, it never submit the checkbox. What is this happenning?
Disabled elements are not submitted. Read-only are.
Posted: Wed Jun 22, 2005 1:32 am
by asmie
Hie,
You will have to apply javascript validation.
The form should be submitted only if the user agrees else the form should not get submitted.
You can try this :
Code: Select all
<script>
function validate(obj)
{
if(obj.value == "e;agree"e;)
{
document.form1.btnSubmit.disabled = false;
}
else
{
document.form1.btnSubmit.disabled = true;
}
}
</script>
<form action="e;"e; method="e;post"e; name="e;form1"e;>
<p>
<input type="e;radio"e; name="e;myradio"e; value="e;agree"e; onClick="e;validate(this)"e;>
Agree
<input type="e;radio"e; name="e;myradio"e; value="e;disagree"e; onClick="e;validate(this)"e;>
Disagree
</p>
<p>
<input type="e;submit"e; name="e;btnSubmit"e; value="e;Submit"e; disabled>
</p>
</form>
Asmie
Posted: Wed Jun 22, 2005 1:34 am
by Syranide
If he isn't allowed to do it... he shouldn't rely on it, as he would eitherway have to check that value to make sure the user didn't "change the matrix"

.
So, disabled checkboxes not being sent is more of a feature if you ask me, as if it is disabled, YOU should know the answer to it, and he should not by any means be able to specify something else.
Posted: Wed Jun 22, 2005 3:46 am
by phpScott
if you really want it then you could store the value in a hidden field with the name of the check box and change the name of the disable checkbox.
Wouldn't neccessarly stop someone from changing it but at least you would have the value.
Re: Submitting the unsubmittable
Posted: Wed Jun 22, 2005 3:49 am
by patrikG
Roja wrote:Disabled elements are not submitted. Read-only are.
is the solution.
Code: Select all
<input name="e;putmein"e; type="e;text"e; size="e;8"e; value="e;€ 699.-"e; readonly="e;readonly"e;>