1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Non-descript form error... "Please enter a valid value."

Discussion in 'XenForo Development Discussions' started by Jaxel, Nov 14, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    Normally when I fail to put something in a form, it will pop up with:
    Code:
    Please enter a value for the required field 'field_name'.
    However, with this new form field I am working on, I am getting this non-descript error that doesn't tell me which field I am missing... Is this normal?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'm assuming this is in a DataWriter? Make sure you have requiredError set:
    PHP:
                    'tag' => array('type' => self::TYPE_STRING'required' => true'maxLength' => 25,
                            
    'verification' => array('$this''_verifyBbCodeId'),
                            
    'requiredError' => 'bbcm_errorInvalidId'
                    
    ),
    When I forget to put 'tag' in, it comes up with "Please enter a valid tag."
     
  3. TheBigK

    TheBigK Well-Known Member

    @Jeremy - I'm stuck with a similar problem. My addon throws following error -

    XenForo - Error
    Please enter a value for the required field 'note_text'.

    I tracked down the error to the following line in my DataWriter: -

    Code:
    'note_text' => array('type' => 'string', 'required' => true) ,
    Turns out that if I set 'required'=>false, it works fine.

    I'm wondering what exactly is the error hinting at? Why is my data-writer failing?
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    You aren't setting the data when calling the data writer.
     
  5. TheBigK

    TheBigK Well-Known Member

    I think I am. Here's how it reads:

    $dw->set('note_text', $note_text);
     
  6. Jake B.

    Jake B. Well-Known Member

    Does $note_text have a value? Or is it empty
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    What is $note_text's value? The error indicates you aren't setting a value.
     

Share This Page