Search code examples
htmlcheckboxmodx

Some form checkbox combinations do not work


I have this code and can't figure out what seems to be the problem: if i select 1 & 2, 1 & 3 it's working. But if I select 2 or 3 only then it's not working. What seems to be the problem? I would like to select multiple at the same time.

i think I need to put some if and else here? But don't really know and sure how?

This is the code:

<div style="background-color:#CCDFED">
<form method="post" action="[~[*id*]~]">
   <input type="hidden" name="formid" value="registrationForm" />
    <table>
    <tr>
     <td>
       <label for="termine" style="margin:0.5em">Termine:</label>
     <td>
     <td>
       <input type="checkbox" name="termine1" value="Montag 4. Oktober 2010"    eform="Termine::1"/>&#09;Montag 4. Oktober 2010 <br/>
       <input type="checkbox" name="termine2" value="Mittwoch 13. Oktober 2010" />&#09;Mittwoch 13. Oktober 2010 <br/>
       <input type="checkbox" name="termine3" value="Freitag 22. Oktober 2010"  />&#09;Freitag 22. Oktober 2010 <br/>           
     </td>
    </tr>       
    <tr>
      <td><label for="email" style="margin:0.5em">Email:</label></td>
      <td><input type="text" name="email" size="60" maxlength="60" eform="Email:email:1" /><td>
    </tr> 
    <tr>
    <td>
       <label style="margin:0.5em; display:block" for="kopieren" >Bitte kopieren Sie den Anti-Spam Code ein: </label>
       <img src="[+verimageurl+]" alt="verification code" border="1" style="margin:0.5em"/></td>
     </td>
     <td valign="top"><input type="text" name="vericode" size="20" /> </td>
    </tr>        
    <tr>
      <td rowspan="3" valign="right">
         <input align="right" type="submit" name="submit" style="margin:0.5em" value="Register" />
      </td>
    </tr>
</table>    
</form>
</div>

Solution

  • You are making them required by setting eform on all of them. Remove the ::1 eform if they are not required. I also added a validation message.

    Try:

     <input type="checkbox" id="termine1" name="termine[]" value="Montag 4. Oktober 2010"    eform="Termine::1:Please select at least one box"/>&#09;Montag 4. Oktober 2010 <br/>
     <input type="checkbox" id="termine2" name="termine[]" value="Mittwoch 13. Oktober 2010" />&#09;Mittwoch 13. Oktober 2010 <br/>
     <input type="checkbox" id="termine3" name="termine[]" value="Freitag 22. Oktober 2010"  />&#09;Freitag 22. Oktober 2010 <br/>  
    

    I am doing all of this blindly, so bear with me. Once you have submitted the form, you now need I no longer see your code for the confirmation page. All you need to change is in your report you need to use

    [+termine+].