17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2185 Views |
-
Gallery & Signup Form clashing

23 September 2008 at 8:19pm Last edited: 24 September 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 nullThese errors didn't appear before i added the signup form code. Can anyone shed some light?
Many thanks again.
-
Re: Gallery & Signup Form clashing

25 September 2008 at 9:52pm Last edited: 25 September 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.
-
Re: Gallery & Signup Form clashing

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/7080Good luck !
| 2185 Views | ||
|
Page:
1
|
Go to Top |


