Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » addErrorMessage to Form shows message on wrong place

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1779 Views
  • Matze0681
    Avatar
    Community Member
    25 Posts

    addErrorMessage to Form shows message on wrong place Link to this post

    hi,

    i try to add a custom form-validation message for "Email is already in use" to a Form. Validation works fine with the following code, but the message does not appear at the correct place(next to the Field OverwriteEmail) but below all the form Fields on the bottom of the form. What did i do wrong?

    thanks in advance for your help!

       $existingMember = DataObject::get_one('Customer',"Email = '".$data['OverwriteEmail']."'");
       if($existingMember) {
    $form->addErrorMessage('OverwriteEmail',
    _t(
    'QuoteBuilder.EMAILEXISTS',
    'Sorry, that email address already exists. Please choose another.'
    ),
    'bad'
    );

    Director::redirectBack();
    return;
    }

  • Rodolfo
    Avatar
    Community Member
    11 Posts

    Re: addErrorMessage to Form shows message on wrong place Link to this post

    I think this is somewhat related to this thread [solved] Passing Errors to Custom Form

    1779 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.