On 04/30/2012 06:31 AM, Gerritjan Koekkoek wrote:
Hi,

The below solution does not create a new document with the expected object;
{{html}}
<form action="${newATEQA}.getURL("objectadd","language=$lang")" id="newdoc"
method="post">
   <div>
     <input type="hidden" name="parent" value="${doc.fullName}"/>
     <input type="hidden" name="template"
value="CdLSATEPublic.CdLSATEPublicTemplate"/>
     <input type="hidden" name="sheet" value="1"/>
     <input type="hidden" name="spaceName" value="CdLSATEPublic"/>
     <input type="hidden" name="CdLSATEPublicClass_ID" value="6"/>
     <input type="hidden" name="CdLSATEPublicClass_ CountryCode" value="us"/>
      <input type="hidden" name="CdLSATEPublicClass_language" value="en"/>
     Document:<input type="text" name="CdLSATEPublicClass_subject"
value="Enter your question here" class="withTip" size="50"/>
     <span class="buttonwrapper"><input type="submit" value="Create this
FAQ" class="button"/></span>
   </div>
</form>
{{/html}}

When you add an object, you should specify what kind of object to add.

You're missing:

<input type="hidden" name="classname" value="CdLSATEPublic.CdLSATEPublicClass" />

Also, a class name should always have both a space name and a document name, you can't just declare a spaceName parameter, as in the add document form. So, all your inputs should be changed like:

<input type="hidden" name="CdLSATEPublic.CdLSATEPublicClass_ID" value="6"/>

Still, that's not the recommended way of creating documents with objects in them. You should create a document template and use it with a normal create request.

I've define a new document name, the intention is that the new document
will be created as a child of the current document with the language
specified and a object of specified class with the attributes as specified
in Inputs.
But I get a dialog for creating a new page that des not exist (which is
correct from the wiki perspective), if i select OK it will create a empty
document with a empty object

What should i do to make this work?

Gerritjan


--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to