Welcome Guest, Not a member yet? Register   Sign In
Using Form Validation with unique dropdown menu selections
#1

[eluser]gscharlemann[/eluser]
I'm importing a csv file and using the first line of the file to compare and match to the column headings of a DB. There can be 10-20 headings csv file and I have the following form:

Code:
<form action="create_race.html" method="post">
<table cellpadding="0" cellspacing="0" border="1">  
  <tr>  
    <td>Place</td>  
    <td><select name="Place">
      <option value="PLACE">PLACE</option>
      <option value="BIB">BIB</option>
      <option value="AGE">AGE</option>
    </select></td>
  </tr>  
  <tr>  
    <td>Age</td>  
    <td><select name="Age">
      <option value="PLACE">PLACE</option>
      <option value="BIB">BIB</option>
      <option value="AGE">AGE</option>
    </select></td>
  </tr>  
  <tr>  
    <td>Bib</td>  
    <td><select name="BIB">
      <option value="PLACE">PLACE</option>
      <option value="BIB">BIB</option>
      <option value="AGE">AGE</option>
    </select></td>
  </tr>
  <tr>
    <td colspan="2">&lt;input type="submit" name="Submit" /&gt;&lt;/td>
  </tr>
</table>
&lt;/form&gt;

Is it possible to use the Form Validation class to ensure that the "PLACE" option is not selected by both the "PLACE" dropdown and the "AGE" dropdown?

Thanks in advance.
#2

[eluser]bretticus[/eluser]
You might try adding a rule to the validation class...

Code:
class MY_Form_validation extends CI_Form_validation {    
    
    function not_match($str1, $str2)
    {
            return ( $str1 != $str2  ) ? TRUE : FALSE;
    }    
}
#3

[eluser]gscharlemann[/eluser]
Good call. I'll play with that. Thanks




Theme © iAndrew 2016 - Forum software by © MyBB