stepo Posted April 12, 2011 Share Posted April 12, 2011 Thanks for that help, can you tell me how to be able to prevent the form from submitting without having a box ticked. Ive tried some code but having trouble getting it to work... <FORM NAME="priceForm" method="post" action="goodbye.php"> <P/> <TABLE> <TR> <TD></TD> <TD></TD> <TD>Price(£)</TD> </TR> <TR> <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Aviation and Aerospace" onClick="showPrices(1)"></INPUT></TD> <TD>Aviation and Aerospace</TD> <TD><INPUT TYPE="text" NAME="AviationField" SIZE="5" VALUE=""></INPUT></TD> </TR> <TR> <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Banks" onClick="showPrices(2)"></INPUT></TD> <TD>Banks</TD> <TD><INPUT TYPE="text" NAME="BanksField" SIZE="5" VALUE=""></INPUT></TD> </TR> <TR> <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Construction" onClick="showPrices(3)"></INPUT></TD> <TD>Construction</TD> <TD><INPUT TYPE="text" NAME="ConstructionField" SIZE="5" VALUE=""></INPUT></TD> </TR> <TR> <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Electronics" onClick="showPrices(4)"></INPUT></TD> <TD>Electronics</TD> <TD><INPUT TYPE="text" NAME="ElectronicsField" SIZE="5" VALUE=""></INPUT></TD> </TR> <TR> <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Oil and Gas" onClick="showPrices(5)"></INPUT></TD> <TD>Oil and Gas</TD> <TD><INPUT TYPE="text" NAME="OilandGasField" SIZE="5" VALUE=""></INPUT></TD> </TR> <TR> <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Pharmaceuticals" onClick="showPrices(6)"></INPUT></TD> <TD>Pharmaceuticals</TD> <TD><INPUT TYPE="text" NAME="PharmaceuticalsField" SIZE="5" VALUE=""></INPUT></TD> </TR> <TR> <TD></TD> <TD>Total:</TD> <TD><INPUT TYPE="text" NAME="TotalField" SIZE="5" VALUE="0"></INPUT></TD> </TR> </TABLE> <p> <input type="submit" name="submit" value="Subscribe"> </FORM> Quote Link to comment https://forums.phpfreaks.com/topic/233492-help-with-preventing-to-submit/ Share on other sites More sharing options...
sunfighter Posted April 12, 2011 Share Posted April 12, 2011 There is probably a better way that checks all boxes, but this will work: Change onClick="showPrices(2)"> For every box to show this onClick="changebox();showPrices(1);"></TD> Then add this js function changebox() { document.getElementById('SelectButton').style.display = "block"; } This css #SelectButton{ display:none; } And add this div to the select button <div id="SelectButton"> <input type="submit" name="submit" value="Subscribe"> </div> PS. Your <INPUT does not need a </INPUT> tag. Quote Link to comment https://forums.phpfreaks.com/topic/233492-help-with-preventing-to-submit/#findComment-1200683 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.