Document.getObject("classname",0) seems to return null when creatin new object

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Document.getObject("classname",0) seems to return null when creatin new object

per.einar
I try to create a new object of a class, but the form does not show up.
$doc.display("title", "edit", $obj) does not bring me an input field.
When investigating, it seems like following call returns a null-object.
 
    #set($obj = $doc.getObject("XWiki.ArticleClass",0))

Anybody with xwiki experience that can explain?
My XWiki Version is 0.9.840


My code to add is from the default xwiki-base and look like this:
1.1 Add a News
#includeTopic("XWiki.XWikiCommonJavascript")
<form action="" id="newdoc">
<input type="hidden" name="parent" value="Main.WebHome" />
<input type="hidden" name="template" value="XWiki.ArticleClassTemplate" />
<input type="hidden" name="sheet" value="1" />
<input type="hidden" name="webname" value="Main"/>
<input type="hidden" name="name" value=""/>
<input type="text" name="title" value="page name" size="18"/>
<input type="button" value="Add this news" onclick='if (updateName(this.form.title,this.form.name)) { action="../../inline/" + this.form.webname.value + "/" + this.form.name.value; this.form.submit(); }' />
</form>


My template looks like this:
#includeForm("XWiki.ArticleClassSheet")

And the ClassSheet start like this:

#set($obj = $doc.getObject("XWiki.ArticleClass",0))
#if($context.action!="inline")
.....
#else
<table border="0">
<tr>
<td>
Title:
</td>
<td>
$doc.display("title", "edit", $obj)
......



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Document.getObject("classname",0) seems to return null when creatin new object

kaaloo
Could you check to see that your ArticleClassTemplate actually has an
instance of an ArticleClass object ?  If it doesn't that would explain
the problem although I'm surprised because those are standard classes.

Luis.

On 2/28/06, [hidden email] <[hidden email]> wrote:

> I try to create a new object of a class, but the form does not show up.
> $doc.display("title", "edit", $obj) does not bring me an input field.
> When investigating, it seems like following call returns a null-object.
>
>     #set($obj = $doc.getObject("XWiki.ArticleClass",0))
>
> Anybody with xwiki experience that can explain?
> My XWiki Version is 0.9.840
>
>
> My code to add is from the default xwiki-base and look like this:
> 1.1 Add a News
> #includeTopic("XWiki.XWikiCommonJavascript")
> <form action="" id="newdoc">
> <input type="hidden" name="parent" value="Main.WebHome" />
> <input type="hidden" name="template" value="XWiki.ArticleClassTemplate" />
> <input type="hidden" name="sheet" value="1" />
> <input type="hidden" name="webname" value="Main"/>
> <input type="hidden" name="name" value=""/>
> <input type="text" name="title" value="page name" size="18"/>
> <input type="button" value="Add this news" onclick='if (updateName(this.form.title,this.form.name)) { action="../../inline/" + this.form.webname.value + "/" + this.form.name.value; this.form.submit(); }' />
> </form>
>
>
> My template looks like this:
> #includeForm("XWiki.ArticleClassSheet")
>
> And the ClassSheet start like this:
>
> #set($obj = $doc.getObject("XWiki.ArticleClass",0))
> #if($context.action!="inline")
> .....
> #else
> <table border="0">
> <tr>
> <td>
> Title:
> </td>
> <td>
> $doc.display("title", "edit", $obj)
> ......
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Luis Arias
http://www.xwiki.com
http://www.innover-entreprendre.net
skype : kaaloo
+33 6 14 20 87 93 mobile



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws