Hi,
I have been able to create a basic form that to allow to store my
registration. Please find below the stuff I use based on Ludovic's advises -
maybe this could help someone.
My next questions:
- where am I supposed to add validation code on the registration field (ex:
validation of email, mandatory fields, ...)
- I would like to send a notification mail when a Registration is created. I
have seen in the documentation that an ad hoc function is provided but where
am I supposed to add the code?
- in Main.TestRegistration, I have hard coded the name of the Registration
instance ("Reg1"). My first idea was to store the registrations under
Registration 1, Registration2, ..., Registrationn. How to automaticcally
calculate the name to use from the data already store in the database? Is
there a better solution?
thanks,
====================
XWiki.RegistrationClass:
attribute name (String)
====================
XWiki.RegistrationClassSheet code (associated with an instance of
RegistrationClass)
1 Registration
#set( $obj = $doc.getObject("XWiki.RegistrationClass", 0))
#set( $class = $obj.xWikiClass)
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td> *First Name:* </td>
<td>$doc.display("first_name", $obj)</td>
</tr>
</table>
====================
XWiki.RegistrationClassTemplate:
#includeForm("XWiki.RegistrationSheet")
====================
Main.TestRegistration:
1 Registration
<form action="" id="newdoc">
#includeTopic("XWiki.XWikiCommonJavascript")
#set( $class = $xwiki.getDocument("XWiki.RegistrationClass").xWikiClass)
#set( $obj = $class.newObject() )
<input type="hidden" name="parent" value="Main.WebHome"
/>
<input type="hidden" name="template"
value="XWiki.RegistrationClassTemplate"
/>
<input type="hidden" name="sheet" value="1" />
<input type="hidden" name="webname" value="Main"/>
<input type="button" value="Register"
onclick='action="../../inline/" +
this.form.webname.value + "/Reg1"; this.form.submit();' />
</form>
====================
--
Mathieu Peltier
ObjectWeb Consortium - INRIA
E-mail: mathieu.peltier(a)inrialpes.fr
JabberID: mpel(a)jabber.fr