Hi, I have a field: deposit_total and I am using JavaScript to calculate the field. I don't want users to input in the field so I have to disable it so they can see the total.
When I do this it will not save to the Database. What is the best way to save this to the database?
My code:
When I do this it will not save to the Database. What is the best way to save this to the database?
My code:
$("#rent_advance,#room_bond,#dps_deposit").on("change", function(){
$("#deposit_total").val(parseInt($("#rent_advance").val()) + parseInt($("#room_bond").val()) + parseInt($("#dps_deposit").val()));
});
Calculate it again using PHP after submit.,
I found a simple way to do it, I added an event on the Submit button to re-enable it. Works!
No that's terrible. If you do it that way I can just manually set the value and send it
Hi spytech,
Disabled fields are not submitted - you need to set it to readonly instead.
And Healyhatman is correct - re-check the calculation after the form is submitted. It's easy enough to edit readonly inputs in the browser if you know what you are doing.
Bob
Disabled fields are not submitted - you need to set it to readonly instead.
And Healyhatman is correct - re-check the calculation after the form is submitted. It's easy enough to edit readonly inputs in the browser if you know what you are doing.
Bob
This topic is locked and no more replies can be posted.