Welcome Guest, Not a member yet? Register   Sign In
Form validation: re-populate empty field
#1

English isn’t my first language, so please excuse any mistakes.

This is my input field:

Code:
<input type="text" name="title" id="title" value="<?php echo set_value('title', $venue['title']) ?>" autocomplete="off" />

According to my validation rules this field is required. After submitting the form with an empty "title" the form is showing the default value of "$venue['title']". I was expecting (and hoping) to see an empty input field. Otherwise the displayed error message (saying this field is required) seems a bit confusing.

It's working (=showing blank field) in CI2 with almost identical code.

Did I miss something?

THX in advance
Reply
#2

(This post was last modified: 03-13-2015, 04:46 AM by ivantcholakov. Edit Reason: A correction of a word )

@Stradge

I also noticed this behavior, and I think in this case (while a previously non-empty field is edited and 'required' rule fails) an empty field should be shown. IMO you are correct.
Reply
#3

This should be checked for check-boxes too. There is a "hidden" rule 'isset'.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB