form validation for NOT matches - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: form validation for NOT matches (/showthread.php?tid=26649) Pages:
1
2
|
form validation for NOT matches - El Forum - 01-19-2010 [eluser]blorriman[/eluser] I have a form and I am using the following to create an input: echo form_input('first_name', set_value('first_name', 'enter first name')); I then validate the form: $this->form_validation->set_rules('first_name', 'Name', 'trim|required'); However, because the form opens with "enter first name" in the text input, the required validation doesn't work. I like the look this way instead of adding a label, but how do I validate this as required now? form validation for NOT matches - El Forum - 01-19-2010 [eluser]JHackamack[/eluser] There are one of two options. You can use placeholder='Enter First Name' which looks similar, but has a default value of "" Or do a client side validation on submit that the form doesn't contain "enter first name" in the first name field form validation for NOT matches - El Forum - 01-19-2010 [eluser]blorriman[/eluser] Thanks JHackaMack, I tried : $name = 'enter name'; echo form_input('first_name', set_value('first_name', $name)); but it's still not validating form validation for NOT matches - El Forum - 01-19-2010 [eluser]JHackamack[/eluser] Try This Code: $data = array( form validation for NOT matches - El Forum - 01-19-2010 [eluser]blorriman[/eluser] Still no luck - it is picking up "set first name" from: 'value' => set_value('first_name','set first name') 'placeholder' => 'First Name', form validation for NOT matches - El Forum - 01-19-2010 [eluser]JHackamack[/eluser] Ah, sorry. Ignore the ",'set first name'" in the value field and try that. form validation for NOT matches - El Forum - 01-19-2010 [eluser]blorriman[/eluser] then the input is empty form validation for NOT matches - El Forum - 01-19-2010 [eluser]JHackamack[/eluser] Can you copy the generated HTML into here? form validation for NOT matches - El Forum - 01-19-2010 [eluser]blorriman[/eluser] Code: <div id="signup_form" class="span-10"> form validation for NOT matches - El Forum - 01-19-2010 [eluser]JHackamack[/eluser] Im looking for how it outputs in your browser. |