Click here to Skip to main content
15,912,504 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to calculate fee total of student,I getting values of fee and when i give discount,concession to student that values store in database.

when i am saving values of disabled text box,It was not saving in database.
Posted
Comments
Sergey Alexandrovich Kryukov 20-Dec-15 1:15am    
And the problem is?..
Why disabled? Why?! Why "text box"? (There is no such thing as "text box" in HTML, but probably you mean input of the type="text", right?) Instead of text box, it could be just p, div, etc.
—SA

1 solution

Not sure what your business rules are, but there is no value for a disabled input box of type text. If you run my example below, you'll see on submit the lname value is not passed, even though I've set it.

<!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" value="fdsa" name="lname" disabled><br>
<input type="submit" value="Submit">
</form>

</body>
</html>


My solution would be to set the textbox to readonly. This will not allow the user to change the value.

A subsequent solution if you are setting the textbox to disabled in JavaScript, then set the value of the soon to be disabled textbox to a hidden value so you can access the value, even though the textbox is disabled and valueless.

<!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname" disabled><br>
<input type="hidden" name="lnameIfDisabled" value="Pizza">
<input type="submit" value="Submit">
</form>

</body>
</html>

Please mark the question as answered if this solves your problem. Thanks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900