Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Gallery & Signup Form clashing


Go to End


4 Posts   2762 Views

Avatar
Briohny

Community Member, 199 Posts

23 September 2008 at 8:19pm

Edited: 24/09/2008 8:40pm

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.

Avatar
Briohny

Community Member, 199 Posts

25 September 2008 at 9:52pm

Edited: 25/09/2008 10:00pm

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.

Avatar
Briohny

Community Member, 199 Posts

7 October 2008 at 4:50am

Bump :)

Anyone?

Avatar
Fuzz10

Community Member, 791 Posts

7 October 2008 at 5:20am

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 !