First, the html -
Expand|Select|Wrap|Line Numbers
- <form id="formFinale" method="post" action="noscript.php" enctype="application/x-www-form-urlencoded">
- <div class="myStyle">Votre nom ? <input type="text" size="36" name="ouchocolat" id="ouchocolat" value="" /></div>
- <div class="myStyle">J’ai lu et je suis d’accord avec les <a href="conditions.html" onclick="this.target='_blank'">conditions générales de vente</a> : <input type="checkbox" name="agree" id="agree" /></div>
- <div class="rightContent right">
- <div class="center"><input type="button" class="button" value="Paiement en ligne" onclick="ifagree('agree','formFinale','getForm.php?ph=3&action=bank');" /></div>
- </div>
- <div class="r">
- <div class="center"><input type="button" class="button" value="Paiement par cheque" onclick="ifagree('agree','formFinale','getForm.php?ph=3&action=check');" /></div>
- </div>
- <div class="clearer"></div>
- </form>
Expand|Select|Wrap|Line Numbers
- function multiSubmit(formId,url) {
- document.getElementById(formId).action=url;
- }
- function ifagree(id,formId,url) {
- if (document.getElementById(id).checked == false) {
- alert('Veuillez accepter les condition général de vente.');
- return false;
- } else {
- if(url) {
- return multiSubmit(formId,url);
- } else {
- return true;
- }
- }
- }
I can see that I am getting the right action in the alert. However, as it stands now, it's simply not working. :(:(:(
What's happening when I tell that it's not working? Well, problem is nothing really is working. No error icon in IE, no error in FF error console, nothing moves as I click on either of these buttons !
Joining the two functions to one doesn't change things either ...
Expand|Select|Wrap|Line Numbers
- function ifagree(id,formId,url) {
- if (document.getElementById(id).checked == false) {
- alert('Veuillez accepter les condition général de vente.');
- return false;
- } else {
- if(url) {
- document.getElementById(formId).action=url;
- } else {
- return true;
- }
- }
- }
Regards.