Hi,
In one of your tutorials (referencing FAQ application) you have shown how to
create custom classes, add properties to it and create objects of these
classes.
This was well understood and thanks for the easy to understand tutorial.
Following the steps I create a space called aeternam and added a page
SupplierClass under it.
Further I create a page "Suppliers" under aeternam space, on which I pasted
the velocity template code to create objects of the SupplierClass and view
create objects.
All works fine. Only problem is the objects are created under the parent
SupplierClass and not under parent Suppliers.
I have explicitly mentioned the parent using the code:
#set( $class = "Supplier")
#set( $defaultparent = "Suppliers")
#set( $defaultweb = "aeternam")
#set( $doc1new =
$xwiki.getDocument("${doc.space}.${class}ClassSheet").isNew())
#set( $doc2new =
$xwiki.getDocument("${doc.space}.${class}ClassTemplate").isNew())
#if (!($doc1new||$doc2new))
1.1 Create a new Supplier
To create a new supplier, you should first choose a name for your supplier.
<form action="" id="newdoc" method="post">
<div>
<input type="hidden" name="parent"
value="${defaultparent}"/>
<input type="hidden" name="template"
value="${doc.web}.${class}ClassTemplate"/>
<input type="hidden" name="sheet" value="1"/>
Space: <input type="text" readonly="true" name="webname"
value="${defaultweb}" size="8"/>
Supplier: <input type="text" name="name" value="Supplier
Name"/>
<br/>
<br/>
## TODO: remove this onclick
<input type="button" value="Create this supplier" onclick='if
(updateName(this.form.name)) {this.form.action="../../inline/" +
this.form.webname.value + "/" + this.form.name.value; this.form.submit();
}'/>
</div>
</form>
1.1 Existing Suppliers
#set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='${doc.web}.${class}Class' and
obj.name<>'${doc.web}.${class}ClassTemplate'")
#foreach ($item in $xwiki.searchDocuments($sql))
* [$item]
#end
#end
So what do I have to do to create objects of a class under some other parent
page not under the default class page.
Next after a document object is created I would like to update the same
document, just like in create is there a template or tutorial that would
help me in understanding how to update a object, so as to complete the CRUD
flow.
Thanks
Sachin
--
View this message in context:
http://www.nabble.com/Creating-structured-objects-tp14268015p14268015.html
Sent from the XWiki- Dev mailing list archive at
Nabble.com.