10377 Posts in 2193 Topics by 1709 members
| Go to End | Next > | |
| Author | Topic: | 4619 Views |
-
Re: Newsletter Module: include subscription form

4 January 2010 at 5:05pm
Nico, how were you able to get it working? I tried adding this:
function ShowForm(){
$get = DataObject::get_one('SubscribeForm', "URLSegment = 'subscribe'");
return new SubscribeForm_Controller($get);
}to my Home.php and the
<% control ShowForm %>
$Form
<% end_control %>to my Home.ss but I keep getting this error:
[User Error] Uncaught Exception: Object->__call(): the method 'fields' does not exist on 'SubscribeForm_Controller'
Any help would be awesome!
~ Valor -
Re: Newsletter Module: include subscription form

13 February 2010 at 1:42am
Same here, running 2.4 Beta (there is a ne release of the Newsletter module or 2.4: RC0.4)
It does work in 2.3.5 so I think userdefinedforms is not ready for 2.4
Did someone get it up and running?
-
Re: Newsletter Module: include subscription form

16 February 2010 at 1:25am Last edited: 16 February 2010 2:16am
I got it - the code is with translatable enabled and on a newsletter without userdefinedforms. Newsletter apparently doesn't need that module anymore according to one of the maintainers.
EDIT: corrected the following code:
public function ShowForm(){
$LocaleLink = 'Locale = \'' . Translatable::get_current_locale() . '\'';
$get = DataObject::get_one('SubscriptionPage', "URLSegment =" .$LocaleLink );
if (isset($get))
return new SubscriptionPage_Controller($get);}
<% if ShowForm %>
<% control ShowForm %>
$Form
<% end_control %>
<% end_if %>And don't forget to add the following to the init() of your pages controler in order to get the validation up and runnning (otherwise people can subscribe without a valid email address)
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); // if you didn't already add this
Requirements::javascript(NEWSLETTER_DIR . '/thirdparty/jquery-validate/jquery.validate.min.js'); -
Re: Newsletter Module: include subscription form

16 February 2010 at 1:35am
I forgot to mention that you have to create a page named "subscribe" in which you include a subscriptionform.
$get = DataObject::get_one('SubscribeForm', "URLSegment = 'subscribe'");
as you see here, it refers to that urlsegment
-
Re: Newsletter Module: include subscription form

16 February 2010 at 1:42am Last edited: 16 February 2010 10:01am
The only thing is that SubscribeForm is probably going to disappear in the near future
since it is based on UserDefinedFormsI believe because it is based on UserDefinedForms. Normann Lou - one of the maintainers of the Newsletter module - urged me to use Subscription Page instead. -
Re: Newsletter Module: include subscription form

16 February 2010 at 9:25am
Yurigoul, why will subscribeForm disappear in the near future?
-
Re: Newsletter Module: include subscription form

16 February 2010 at 9:53am
Is UserDefinedForms disappearing soon?
-
Re: Newsletter Module: include subscription form

16 February 2010 at 9:57am
I got the following mail from one of the maintainers:
---------------
We are not using UserForm for Newsletter anymore since 0.3, though there are some code still there and we need to remove them.Please use the new page type "Subscription Page" which use the similar things as userform but totally detached from user from to avoid:
1. modules dependency each other.
2. version conflict each other.-----------------
SubscribeForm is based on UserDefinedForm and that in turn is defined inside the UserForm module - unless it is also defined somewhere else.
| 4619 Views | ||
| Go to Top | Next > |


