Forums

Can't submit form when validation is on

mett 28 Nov, 2007
Sorry for my english, it's not my native language

I use latest version, 2.3.6.

I'm not sure if it is a bug but this is what happened with my form: if i choose to validate only "<select>" fields, everything it's ok. When i add radio group buttons, my form doesn't submit information, instead show me a message to choose some options, but i already choose.

I try to use only first option from validation area: 1 - required (not blank). Nothing happened, my form is submited no matter if textfields are blank or not. Same situation for option 5- validate-alphanum (only letters and numbers)


Please help, i need to validate textfields, radio group and select option all together in a form

thank you
GreyHead 29 Nov, 2007
Hi mett,

Please take a backup copy of your form and post it here, or email it to info at greyhead.net and I'll have a look.

Thanks

Bob
mett 29 Nov, 2007
Hi GreyHead

this is my code for form i use. It's a feedback trainer form, users have to select radio buttons, name of trainer + course name and leave comments

Thanks


<?php 
global $mainframe;
$mainframe->setPageTitle("Feedback Trainer"«»);
?>
<table width="95%" border="0" cellspacing="0" cellpadding="0" height="100%" bgcolor="#F0F4F0" align="center">
  <tr> 
    <td width="1" height="1" bordercolor="#C7C7C7"></td>
    <td height="1" bgcolor="#C7C7C7" bordercolor="#666666"></td>
    <td width="1" height="1" bordercolor="#FF0000"></td>
  </tr>
  <tr> 
    <td width="1" height="" bgcolor="#C7C7C7"></td>
    <td> 
      <form name="form1">
        <table width="100%" border="0" cellspacing="2" cellpadding="2">
          <tr bgcolor="#FF0000"> 
            <td colspan="8"> 
              <div align="center" class="txtb"><font color="#FFFFFF">FORMULAR 
                DE EVALUARE</font></div>
            </td>
          </tr>
          <tr> 
            <td width="25%"> 
              <div align="right">Instructor</div>
            </td>
            <td width="25%"> 
              <div align="left"> 
                <select name="trainer">
                  <option value="sel" selected>-selectati-</option>
                  
                  <option value="Victor">Victor</option>
                  <option value="Andrei">Andrei</option>

                </select>
              </div>
            </td>
            <td colspan="3"> 
              <div align="right">Denumire Curs</div>
            </td>
            <td colspan="3"> 
              <div align="left"> 
                <select name="curs">
                  <option value="sel" selected>-selectati-</option>
                  
                  <option value="Curs 1">Curs 1</option>
<option value="Curs 2">Curs 2</option>
                  
                </select>
              </div>
            </td>
          </tr>
          <tr> 
            <td width="25%"> 
              <div align="right">Data</div>
            </td>
            <td width="25%"> 
              <div align="left"> 
                <input type="text" name="data" size="12" maxlength="12" value="<?php echo date("Y-m-d"«»); ?>" onFocus="this.blur()">
              </div>
            </td>
            <td colspan="3"> </td>
            <td colspan="3"> </td>
          </tr>
          <tr> 
            <td colspan="8" class="mini"> 
              <div align="center"><font color="#0000FF">Va rugam sa selectati 
                pentru fiecare intrebare o nota. Comentariile sint optionale.</font></div>
            </td>
          </tr>
          <tr bgcolor="#FF0000"> 
            <td colspan="8" class="txtb"> 
              <div align="center"><font color="#FFFFFF">1. CONTINUTUL PROGRAMULUI</font></div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3"> 
              <div align="center">Care este parerea ta despre ...</div>
            </td>
            <td width="8%"> 
              <div align="center">Foarte<br>
                bun </div>
            </td>
            <td width="8%"> 
              <div align="center">Bun</div>
            </td>
            <td width="8%"> 
              <div align="center">Satis-<br>
                facator </div>
            </td>
            <td width="8%"> 
              <div align="center">Slab</div>
            </td>
            <td width="8%"> 
              <div align="center">Foarte Slab</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Imaginea de ansamblu a cursului</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r1" value="5">
                5 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r1" value="4">
                4 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r1" value="3">
                3 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r1" value="2">
                2 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r1" value="1">
                1 </div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Claritatea programului</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r2" value="5">
                5 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r2" value="4">
                4 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r2" value="3">
                3 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r2" value="2">
                2 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r2" value="1">
                1 </div>
            </td>
          </tr>
          <tr> 
            <td colspan="3">Simularile/exercitiile alese pt. exemplificarea subiectelor 
              predate </td>
            <td> 
              <div align="center"> 
                <input type="radio" name="r3" value="5">
                5 </div>
            </td>
            <td> 
              <div align="center"> 
                <input type="radio" name="r3" value="4">
                4 </div>
            </td>
            <td> 
              <div align="center"> 
                <input type="radio" name="r3" value="3">
                3 </div>
            </td>
            <td> 
              <div align="center"> 
                <input type="radio" name="r3" value="2">
                2 </div>
            </td>
            <td> 
              <div align="center"> 
                <input type="radio" name="r3" value="1">
                1 </div>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Care exercitiu a fost cel mai util pentru tine ?</p>
              <p align="center"> 
                <textarea name="com1" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Ce subiect crezi ca s-ar putea exclude din acest curs ?</p>
              <p align="center"> 
                <textarea name="com2" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Ce subiect crezi ca s-ar putea adauga ?</p>
              <p align="center"> 
                <textarea name="com3" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr bgcolor="#FF0000"> 
            <td colspan="8"> 
              <div align="center" class="txtb"><font color="#FFFFFF">2. FACILITATORUL 
                CURSULUI</font></div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3"> </td>
            <td width="8%"> 
              <div align="center">Foarte<br>
                bun </div>
            </td>
            <td width="8%"> 
              <div align="center">Bun</div>
            </td>
            <td width="8%"> 
              <div align="center">Satis-<br>
                facator </div>
            </td>
            <td width="8%"> 
              <div align="center">Slab</div>
            </td>
            <td width="8%"> 
              <div align="center">Foarte Slab</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Pregatirea instructorului pentru a preda 
              acest curs</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r4" value="5">
                5 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r4" value="4">
                4 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r4" value="3">
                3 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r4" value="2">
                2 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r4" value="1">
                1 </div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Expune clar si concis informatia</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r5" value="5">
                5</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r5" value="4">
                4 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r5" value="3">
                3 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r5" value="2">
                2</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r5" value="1">
                1</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Incurajeaza participarea la training</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r6" value="5">
                5</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r6" value="4">
                4</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r6" value="3">
                3</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r6" value="2">
                2</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r6" value="1">
                1</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Bunavointa instructorului in oferirea 
              de ajutor / asistenta</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r7" value="5">
                5</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r7" value="4">
                4 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r7" value="3">
                3</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r7" value="2">
                2</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r7" value="1">
                1</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Leaga teoria de practica prin exemple 
              relevante </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r8" value="5">
                5 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r8" value="4">
                4</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r8" value="3">
                3 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r8" value="2">
                2</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r8" value="1">
                1</div>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Ce ti-a placut in modul de predare al instructorului ?</p>
              <p align="center"> 
                <textarea name="com4" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Ce crezi ca ar trebui sa faca diferit ?</p>
              <p align="center"> 
                <textarea name="com5" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr bgcolor="#FF0000"> 
            <td colspan="8"> 
              <div align="center" class="txtb"><font color="#FFFFFF">3. ALTE COMENTARII</font></div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3"> </td>
            <td width="8%"> 
              <div align="center">Foarte<br>
                bun </div>
            </td>
            <td width="8%"> 
              <div align="center">Bun</div>
            </td>
            <td width="8%"> 
              <div align="center">Satis-<br>
                facator </div>
            </td>
            <td width="8%"> 
              <div align="center">Slab</div>
            </td>
            <td width="8%"> 
              <div align="center">Foarte Slab</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Materialul de training este usor de inteles 
              ? </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r9" value="5">
                5</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r9" value="4">
                4</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r9" value="3">
                3</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r9" value="2">
                2</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r9" value="1">
                1</div>
            </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3">Cum corespunde acest curs asteptarilor 
              tale ?</td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r10" value="5">
                5 </div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r10" value="4">
                4</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r10" value="3">
                3</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r10" value="2">
                2</div>
            </td>
            <td width="8%"> 
              <div align="center"> 
                <input type="radio" name="r10" value="1">
                1</div>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Ce te-a impresionat cel mai mult la acest curs ? (impresia pozitiva)</p>
              <p align="center"> 
                <textarea name="com6" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Ce te-a impresionat cel mai mult la acest curs ? (impresia negativa)</p>
              <p align="center"> 
                <textarea name="com7" cols="60" rows="2"></textarea>
<br>

              </p>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <p>Daca acest curs nu a corespuns asteptarilor tale, ce sugerezi 
                sa facem diferit ?</p>
              <p align="center"> 
                <textarea name="com8" cols="60" rows="2"></textarea>
              </p>
            </td>
          </tr>
          <tr bgcolor="#FF0000"> 
            <td colspan="8" class="txtb"> 
              <div align="center"><font color="#FFFFFF">4. ALTE COMENTARII SI 
                OBSERVATII :</font></div>
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <div align="center"> 
                <textarea name="com" cols="60" rows="2"></textarea>
<br>

              </div>
            </td>
          </tr>
          <tr> 
            <td height="20" colspan="8"> </td>
          </tr>
          <tr> 
            <td width="60%" colspan="3"> 
              <div align="right">Numele (optional)</div>
            </td>
            <td colspan="5"> 
              <input type="text" name="nume" size="25" maxlength="25">
            </td>
          </tr>
          <tr> 
            <td colspan="8"> 
              <div align="right"> 

                <input type="submit" name="Submit" value="Inregistreaza">
              </div>
            </td>
          </tr>
        </table>
      </form>
    </td>
    <td width="1" height="263" bgcolor="#969696"></td>
  </tr>
  <tr> 
    <td width="1" height="1"></td>
    <td bgcolor="#969696" height="1"></td>
    <td width="1" height="1"></td>
  </tr>
</table>
GreyHead 29 Nov, 2007
Hi mett,

A few things to look at here.

First this is an incredibly long form to debug. Please try testing on a short version. Here's the cut down version that I've used.
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr bgcolor="#FF0000"> 
    <td colspan="8"> 
      <div align="center" class="txtb">
        <font color="#FFFFFF">FORMULAR DE EVALUARE</font>
      </div>
    </td>
  </tr>
  <tr> 
    <td width="25%"> 
      <div align="right">Instructor</div>
    </td>
    <td width="25%" colspan='7'> 
      <div align="left"> 
        <select name="trainer">
          <option value="sel" selected>-selectati-</option>
          <option value="Victor">Victor</option>
          <option value="Andrei">Andrei</option>
        </select>
      </div>
    </td>
  </tr>
  <tr> 
    <td width="25%"><div align="right">Data</div></td>
    <td width="25%"> 
      <div align="left"> 
        <input type="text" name="data" size="12" maxlength="12" value="<?php echo date("Y-m-d"«»); ?>" onFocus="this.blur()">
      </div>
    </td>
    <td colspan="3"> </td>
    <td colspan="3"> </td>
  </tr>
  <tr> 
    <td colspan="8" class="mini"> 
      <div align="center"><font color="#0000FF">Va rugam sa selectati pentru fiecare intrebare o nota. Comentariile sint optionale.</font></div>
     </td>
   </tr>
   <tr bgcolor="#FF0000"> 
     <td colspan="8" class="txtb"> 
       <div align="center"><font color="#FFFFFF">1. CONTINUTUL PROGRAMULUI</font></div>
     </td>
   </tr>
   <tr> 
     <td width="60%" colspan="3"> 
       <div align="center">Care este parerea ta despre ...</div>
     </td>
     <td width="8%"> 
       <div align="center">Foarte<br>bun </div>
     </td>
     <td width="8%"> 
       <div align="center">Bun</div>
     </td>
     <td width="8%"> 
       <div align="center">Satis-<br>facator </div>
     </td>
     <td width="8%"> 
       <div align="center">Slab</div>
     </td>
     <td width="8%"> 
       <div align="center">Foarte Slab</div>
     </td>
   </tr>
   <tr> 
     <td width="60%" colspan="3">Imaginea de ansamblu a cursului</td>
     <td width="8%"> 
       <div align="center"> 
          <input type="radio" name="r1" value="5">5 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r1" value="4">4 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r1" value="3">3 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r1" value="2">2 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r1" value="1">1 </div>
     </td>
   </tr>
   <tr> 
     <td width="60%" colspan="3">Claritatea programului</td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r2" value="5">5 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r2" value="4">4 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r2" value="3">3 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r2" value="2">2 </div>
     </td>
     <td width="8%"> 
       <div align="center"> 
         <input type="radio" name="r2" value="1">1 </div>
     </td>
   </tr>
   <tr> 
     <td colspan="8"> 
       <p>Care exercitiu a fost cel mai util pentru tine ?</p>
       <p align="center"> 
         <textarea name="com1" cols="60" rows="2"></textarea>
       </p>
    </td>
  </tr>
  <tr> 
    <td colspan="8"> 
      <div align="right"> 
         <input type="submit" name="Submit" calue="Inregistreaza">
      </div>
    </td>
  </tr>
</table>
There's an example of everything important but much less room for errors and confusion.

2: You have <form> tags in your code, ChronoForms adds it own form tags and having two sets leads to problems.

3: You have a default select option
<option value="sel" selected>-selectati-</option>
and the validator can't tell the difference between this and the 'real' options.

4: Validating radio buttons takes a slightly different approach. Her are the notes from Andrew Tetlaw's documentation.

*To use the validate-one-required validator you must first add the class name to only one checkbox/radio button in the group (last one is probably best) and then place all the input elements within a parent element, for example a div element. That way the library can find all the checkboxes/radio buttons to check and place the validation advice element at the bottom of the parent element to make it appear after the group of checkboxes/radio buttons.

It doesn't look as though ChronoForms implements this quite as well as it should.

I'm not sure that these fixes will sort out all your problems but please try them and see what is then working - or not.

Bob
This topic is locked and no more replies can be posted.