View Full Version : disable the "SUBMIT" button until a couple of buttons are pressed first
08-06-2012, 07:28 PM
hey people, i have a small problem for an order form. I have several sections within an order form. each section contains various products which have a value to it. A customer, when placing order will select products within a section or in different sections. each section will have a "total" button within. when clicked on, it will show the sub total of products within that particular section.
At the end of the form there is a button for the grand total, which will show the total cost of products from various sections that were selected.
what i want is the submit button to be disabled until.......
1) one or more (14 subtotal buttons) are clicked, so that the customer can view the subtotal
2)the grand total button is clicked so that the customer knows the total cost of the order.
would really appreciate it if someone could help
08-06-2012, 07:44 PM
08-06-2012, 08:30 PM
sorry VIPStephan, thank you for that
08-06-2012, 10:57 PM
08-06-2012, 11:43 PM
Yeah, that’s the point I was making. PHP functionality has to come first before any JS enhancements are done. One shouldn’t rely on JS alone.
08-07-2012, 04:35 AM
08-07-2012, 02:51 PM
For example, I have a website on which players can build a grid map. I could have written A LOT of PHP to make a grid map work without JS, and then written the same amount of JS to do it. And in the end, people using it with the PHP would have just gotten frustrated, it'd be a lot more bug prone, etc. Instead, when JS isn't active, my system tells them the site won't function without it.
In this case, I think building a JS solution with a PHP redundancy is the right choice, specially as neither will be complicated. I don't think we should stay locked in to the idea that the site should ALWAYS work without JS and should just be prettier with it.
08-07-2012, 05:12 PM
yes keleth i want it to be done before submission, i personally dont think its anything to do with php becos all i want is the submit button to be disabled until other buttons are clicked? but i may be wrong
08-07-2012, 05:54 PM
The basic code for enable/disable is:
<form action="" method="post">
<input name="rad" type="radio" value="Yes" onclick="this.form['sub'].disabled=false"> YES
<input name="rad" type="radio" value="No" onclick="this.form['sub'].disabled=true"> NO
<input type="submit" name="sub" value="Submit" disabled>
This is for radio buttons but the same code can be used for buttons.
08-08-2012, 10:13 AM
thnx andrew, theres several buttons on this button, is there any way of linking these buttons to the submit button, so that a customer has to click on one or buttons before clicking the submit button