Hello,
Using Power, (06-07-2011 nightly)
I think there is are two problems with the velocity mail template system , in some occasions.
Consider this form to be submitted, to a Student.ds.xml (SQL) datasource:
client side:
As you can see,
A student fills out his personal details (email, name, etc.) and presses a button that saves the form. He also marked a few courses he wants to enroll for. This is passed on in the map 'courseEditions', which is a List<Integer>
Student.ds.xml
First problem: the $courseEditions and $hostname (which are the extra values put into the map) are not available in the template. Putting them in the template as $hostname just puts '$hostname' in the email. Also, in my dmi method, dsRequest.getFieldValue("hostname") does actually work in Java, it returns the correct value.
Second problem: somehow, because courseEditions is a list<Integer> the mail is sent twice. If I remove this part, the mail is sent once. I am not totally convinced yet what happens, but I am still investigating this.
As far as the first problem is concerned: is this on purpose, or is this just a missing feature? Would love to be able to add some extra stuff to the form. The values ARE available in the dmi serverObject that is called, i've checked this.
Any thoughts on any of the problems?
Using Power, (06-07-2011 nightly)
I think there is are two problems with the velocity mail template system , in some occasions.
Consider this form to be submitted, to a Student.ds.xml (SQL) datasource:
client side:
Code:
Map vals = form.getValues(); vals.put("hostname", "someHostname"); vals.put("courseEditions", courseWid.getSelectedIds()); //List<Integer> is passed here form.setValues(vals); form.saveData();
A student fills out his personal details (email, name, etc.) and presses a button that saves the form. He also marked a few courses he wants to enroll for. This is passed on in the map 'courseEditions', which is a List<Integer>
Student.ds.xml
Code:
<DataSource ...> ... <operationBinding operationType="add" requiresAuthentication="false" cacheSyncOperation="publicStudentRegistrationFetch" requiresRole="" operationId="publicStudentRegistration" > <serverObject className="nl.sytematic.projects.MyProject.server.custom.dmi.CustomStudentDMI"/> <mail> <from>noreply@mydomain.nl</from> <to>$email</to> <templateFile>emailtemplates/student_subscribe.txt</templateFile> <subject>My subject</subject> </mail> </operationBinding> <operationBinding operationType="fetch" requiresAuthentication="true" requiresRole="CAN_READ_STUDENT">
Second problem: somehow, because courseEditions is a list<Integer> the mail is sent twice. If I remove this part, the mail is sent once. I am not totally convinced yet what happens, but I am still investigating this.
As far as the first problem is concerned: is this on purpose, or is this just a missing feature? Would love to be able to add some extra stuff to the form. The values ARE available in the dmi serverObject that is called, i've checked this.
Any thoughts on any of the problems?
Comment