Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
FIELDSET Class
  • Is there a way to display errors inline with the fields?
  • You could check each post - Quick example: if($_POST)
    {
    $data = $val->validated('username');
    $data = 'Wrong username or password';
    } Then echo $error_user_pass.
  • Sorry, I meant using the FIELDSET class.
  • Phil Foulston wrote on Thursday 21st of July 2011:
    You could check each post - Quick example: if($_POST)
    {
    $data = $val->validated('username');
    $data = 'Wrong username or password';
    } Then echo $error_user_pass.

    BTW, I tried checking for $_POST and for some reason it always returned something, even if nothing was posted. i think it might be something with the sanitation Class...
  • Chase Hutchins wrote on Thursday 21st of July 2011:
    Is that something "null"? If so, that is intended. It allows you not to have to check isset() each time, and rather utilize the value, or reference it as empty.

    Right, I tried: if($_POST)
    do something...
    else
    do nothing and POST was always fired. In other words, i didn't check the actual value of $_POST but my condition was always running TRUE
  • Create a Validation object then try putting it inside a: if($val->run())
    {
    if($_POST)
    {
    do something...
    }
    else
    {
    do nothing
    }
    } If you get what I mean :)
  • Cool.. i'll try it
  • echo \Fieldset::instance('name')->errors('field_name');
    

    That should do it for you.
  • Cool!!! Since FIELDSET generates the form, can it also add the errors inline?
  • Not inline. To do that you have to do the form by hand. Through the fieldset class.
  • How would I do that? Should I use the FIELDSET in the controller and then call its instance in the views? Do you have a simple example? THANK YOU!!
  • Helmer has a repo that uses it. I think it's called fueldocgenerator.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion