0

I'm using Tank Auth (it's working fine), but I can't get the form validation function to work when I include any value in the variable array along with set_value. I need these values as a label for form fields--they tells the user what to enter in the field.

How can I keep Tank Auth's form validation functionality AND use a value in the value field?

$login = array(
    'name'  => 'login',
    'id'    => 'login',
    'value' => set_value('login', 'Enter username'),
);
chowwy
  • 1,126
  • 8
  • 26
  • 45

1 Answers1

1

this populates field values : set_value('field_name');

this shows individual errors: form_errors('field_name');

If you use html5, you can simply add a placeholder!

{ placeholders should not be used as an alternative to labels!}

$login = array(
    'name'  => 'login',
    'id'    => 'login',
    'value' => set_value('login'),
    'placeholder' => 'Enter Username',
    'required' => 'required'
);
Philip
  • 4,592
  • 2
  • 20
  • 28
  • Okay, I'll try this, but why shouldn't placeholder's be used as labels? – chowwy Jan 25 '12 at 20:12
  • This worked! Accepted and upvoted. Would really like to know why placeholders shouldn't be used as labels, though. – chowwy Jan 25 '12 at 20:20