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.

Form Questions /

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

control children + form


Go to End


4 Posts   3281 Views

Avatar
janulka

Community Member, 80 Posts

18 December 2008 at 11:00pm

Hei,

I want to have contact form and subscription for newsletters on same page..

I created Page called Contact, then under it UserDefinedForm and SubscribeForm

Then on Page.ss I have following:

<% control Children %>
$Content
$Form
<% end_control %>

But the form doesn't show up. Help plz? thanks

Avatar
Liam

Community Member, 470 Posts

19 December 2008 at 6:12am

So you created 2 sub pages under the parent page of contact form with these forms? They aren't going to show up on the parent page by default, as they're different pages. Unless I'm not understanding what you did.

Anyway, I think you'll have to write custom forms manually you achieve this. A page can't be 2 different page types, and I'm not sure something like <% control Children %> would work and grabbing the form info from a parent page.

Avatar
dospuntocero

Community Member, 54 Posts

5 March 2009 at 12:25am

Edited: 05/03/2009 12:26am

The best way to do this is in your Page.php add the function to control your Subscription and your contact form, so you could put in your Page.ss

instead of
<% control Children %>
$Content
$Form
<% end_control %>

just $Subscription and $ContactForm
to learn more about forms read this amazing tutorial
and you can learn about forms in silverstripe here too

Avatar
Briohny

Community Member, 199 Posts

28 March 2009 at 12:55am

Hi LeeUmm, maybe you can help me. My issue kind of relates to this thread:

I have a contact (userdefined form) and a newsletter signup ($SignUpForm) on the same page. Both forms appear perfectly however the validation is messy. When you hit submit on the contact form, an error message appears (IE) 'object does not support this property or method' and the form validation fields turn from strings to 'EditableEmailField3 is required'. If i take away the SignUp form, it's fine. They are obviously conflicting.

Would you know how i could fix this please?

Many thanks.