codeigniter-form-helper

Codeigniter - edit form (repopulating) with edit_unique

依然范特西╮ 提交于 2019-12-02 02:44:22
It seems that the edit_unique function, which is desribed here - Validating Uniqueness In CodeIgniter When Updating A Record , kills the set_value function. All works fine, which something like this... echo form_input('username', set_value('username',$user->username)); But when using the edit_unique validation, the value is empty after submitting the form. Post-Variables are ok and also the validation has no errors - but the value is not set. Any idea how I can fix that? Ok - found it myself. There was no return value in case of beeing true. Perhaps anyone faces the same problem... with this

Codeigniter - Date format - Form Validation

我的未来我决定 提交于 2019-11-27 01:54:54
问题 I'm using codeigniter with PHP . I'm using following form, <?php echo form_open('/register/create_new', $form_params); ?> DOB: <input type="text" id="dob" name="reg[dob]"> <input type="submit" value="Create Account" /> </form> here, #dob is in dd-mm-yyyy format. my validation code is, array( 'field' => 'reg[dob]', 'label' => 'DOB', 'rules' => 'required' ) How can i set the rules for correct date validation? 回答1: you can do it with regex $this->form_validation->set_rules('reg[dob]', 'Date of