10379 Posts in 2194 Topics by 1710 members
| Go to End | Next > | |
| Author | Topic: | 22884 Views |
-
Re: UserForms 0.2

8 July 2009 at 2:26am Last edited: 10 July 2009 5:03pm
As reported by Kateh, translated forms are not working when upgrading: no fields can be added and no email recipients (error: I can't handle sub-URLs of a CMSMain object).
Nevertheless, you can create a new translation of the form and adding fields should work, the problem is you can't see them in the published page.
SOLUTION: Changing by hand the ParentID of the fields in the EditableFormField table. I'm sure willr will correct the faulty code in a blink!
-
Re: UserForms 0.2

8 July 2009 at 2:38am Last edited: 10 July 2009 5:03pm
Didn't solve my problem. switched everthing back to en_US. Still a white page with Submit-Button and no fields
-
Re: UserForms 0.2

8 July 2009 at 3:57am Last edited: 10 July 2009 5:03pm
Hi!
In order to work it here with 2.3.2, I downloaded several days ago userforms trunk (80961). Then I created a new contact form in the default language, then a translation, then Email recipients for both. Finally I manually updated the ParentID in EditableFormField table and the FormID in the UserDefinedForm_EmailRecipient table.
That's all. Kate, did you tried starting from scratch and manually updating the database?
Good luck,
Juan -
Re: UserForms 0.2

9 July 2009 at 7:21pm Last edited: 10 July 2009 5:03pm
Hi can somebody post a new link none seem to work? does it come with updated install instructions.
-
Re: UserForms 0.2

9 July 2009 at 7:23pm Last edited: 10 July 2009 5:03pm
To get the latest. Will release a new rc pretty soon
-
Re: UserForms 0.2

9 July 2009 at 10:08pm Last edited: 10 July 2009 5:03pm
I'm not sure if this is possible.... I want to change the html outputted by the form. I'd really like to put the form filelds in an unordered list. How easy would this be to do?
-
Re: UserForms 0.2

10 July 2009 at 3:25am Last edited: 10 July 2009 5:03pm
Hi!
It's quite easy, I've just done it, but I'm quite sure it can be done even easier.
In /templates/email/ folder you have SubmittedFormEmail.ss, where you can use something like:
<% control Fields %>
<ul>
<li><span class="emphasis">$Title</span>:
<% if Value = on %>
Yes
<% else %>
$Value
<% end_if %>
</li>
</ul>
<% end_control %>If you want to use specific templates, the only way I have found is to to create a new Page type where you subclass UserDefinedForm, UserDefinedForm_controller and Email (look at UserDefinedForm.php). In MyFantasticUserDefinedForm_controller you must have a process() method where you replace:
$email = new UserDefinedForm_SubmittedFormEmail($submittedFields);
…with the name of the custom Email subclass.In this custom process() method you can add data to your email template via the $emailData array, e.g.:
$emailData = array(
"Sender" => Member::currentUser(),
"Fields" => $submittedFields,
// Added for sending different messages to clients and admin
"ForAdmin" => true
);
Then, for example where it says later:if($recipient->SendEmailFromFieldID) {
// Used in template if for hiding form fields from clients
$emailData['ForAdmin'] = false;
Then, in your custom email template:<h2>$Subject</h2>
$Body
<% if ForAdmin %>
<% control Fields %>
<p>
<span class="emphasis">$Title</span></br>
<% if Value %>
<% if Value = --choissisez-- %>
<span style="color:red">Non renseigné</span>
<% else %>
$Value
<% end_if %>
<% else %>
<span style="color:red">Non renseigné</span>
<% end_if %>
</p>
<% end_control %>
<% end_if %>In this way, the admin receives a message with all the fields of the form and the client only a message with the $Body defined in the CMS, for example saying ‘Form received, thanks!’.
Hope it helps,
Juan -
Re: UserForms 0.2

10 July 2009 at 3:26am Last edited: 10 July 2009 5:03pm
By the way, willr, when we could use complex values in template controls? I had to do all this ForAdmin trick because I cannot simply put something as:
<% if To = admin@mysite.com %>
The @ breaks the parser. Also, I have to use, for field values, the kind of ‘--choissisez--’ (‘--choose--’), all in ASCII, instead of a word or several of them containing ‘special’ chars as é, ç or ñ, or even an space.
Well, that's not the fault of userforms…
Best regards,
Juan
| 22884 Views | ||
| Go to Top | Next > |



