Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Gallery & Signup Form clashing

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2374 Views
  • Briohny
    Avatar
    Community Member
    199 Posts

    Gallery & Signup Form clashing Link to this post

    I had the lightbox gallery working perfectly. I then decided to add a new signup form and added the following code to my page.php file:

    function SignUpForm() {
    return new Form($this, "SignUpForm", new FieldSet(
    new EmailField("Email", "Email Address")

    ), new FieldSet(
    new FormAction("signup", "Sign up")

    ), new RequiredFields(
             "Email"
    ));
    }
    function signup($data, $form) {
    $member = new Member();
    $form->saveInto($member);

    $member->write();

    if($group = DataObject::get_one('Group', "Code = 'ISA-NEWSLETTERS'")) {
    $member->Groups()->add($group);
    }

    Director::redirect('thanks-for-registering/');
    }

    This form works great, only now my lightbox doesn't work. The gallery thumbnails appear but when you click on them nothing happens. Firefox gives the following two errors:

    1. Prototype.Browser is undefined
    2. $("lightwindow_navigation") is null

    These errors didn't appear before i added the signup form code. Can anyone shed some light?

    Many thanks again.

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: Gallery & Signup Form clashing Link to this post

    ok, when i remove this code:

    , new RequiredFields(
             "Email"
    )

    the gallery and the form both work. However the form now doesn't validate which means that anyone can submit an empty form. Is there another way to validate or perhaps re-jigging the code above so that it works without upsetting the gallery.

    Any thoughts? Thanks.

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: Gallery & Signup Form clashing Link to this post

    Bump

    Anyone?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Gallery & Signup Form clashing Link to this post

    Hmm... would not be surprised if the JS validation stuff does not play nice with the gallery.

    Check out this thread :
    http://www.silverstripe.com/extending-hacking-silverstripe-forum/flat/7080

    Good luck !

    2374 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.