Hi, To help I would need to know if the objective is to register user on the wiki or if the registration is for some other purpose. I suppose it is separate from the wiki registration. In this case you are pretty close to it.. The only thing that is wrong is the "saving" part. You have currently copied the way it is done for the wiki registration (which calls the createUser function which does the actual wiki page creation but also other things). The right way to do it for other data than user registration is to redirect the form to the "inline" or "save" action. If you redirect the form to the inline action you will get a form that users can fill in and that will then go to the "save" action. This is the way it works for blog articles in the default wiki. However this means two steps: one for choosing the wiki page name which will hold the information and the other for filing in the data itself. You can however directly send the data to the "save" page. The following code allows to direct to the "inline" action #includeTopic("XWiki.XWikiCommonJavascript") <form action="" id="newdoc"> <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="text" name="name" value="name" size="18"/> <input type="button" value="Add this item" onclick='if (updateName(this.form.name)) { action="../../inline/" + this.form.webname.value + "/" + this.form.name.value; this.form.submit(); }' /> </form> Ludovic Ludovic Dubost a écrit :
Hi, I am completly new to xwiki. I would like to create a basic form to store registration (only last name info for the moment). Here is what I have already tried, but it does not work. I don't understand what I am supposed to do in order to store the new registration (should I create a Java class for this?) Any help would be appreciate - is there some demo available? thanks,
==================== XWiki.RegistrationClass: attribute name (String) ==================== XWiki.RegistrationClassSheet code: 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.Registration: 1 Registration #set ($register = $request.getParameter("register"))
#if ($register) Registration of *$request.getParameter("register_first_name")*
#set( $class = $xwiki.getDocument("XWiki.RegistrationClass").xWikiClass) #set( $reg = $class.newObject() ) #set($class.first_name = $request.getParameter("register_first_name"))
#if ($reg>0) Your registration has been correctly registered. Thanks. #else Sorry, an error occured during the registration process. #end
#else Please provide us with the following information:
<form id="register" name="register" action="" method="get"> <input type="hidden" name="template" value="XWiki.RegistrationTemplate" /> <input type="hidden" name="register" value="1"> #set( $class = $xwiki.getDocument("XWiki.RegistrationClass").xWikiClass) #set( $obj = $class.newObject() )
<table class="block" cellspacing="5px" border="0"> <tr> #set($prop = $class.first_name) <td>First Name</td> <td>$doc.displayEdit($prop, "register_", $obj)</td> </tr> </table> <input type="submit" value="Save My Registration"> </form> #end ====================
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic