Hello there!
I am completely new to XWiki and I am trying out some features. I am native German, so please forgive me my bad English. I hope you can help me with my “special” problem:
I would like to create a template including a HTML form which other users can use to create new pages.
Through the search function i found following instructions written in the FAQ of XWiki:
How can I create a new page based on a form?
So far so good.
The new created page (from the template & HTML form) should now be editable. For that there should be a “save changes” button at the bottom of the Page.
So that i have a “interactive page with a given, not changeable structure through HTML forms”. Users then can only edit the HTML input-areas and can’t edit the structure of the page.
Is this even possible and if yes, how?
Some additional information:
I am using XWiki 10.2 on a Ubuntu 16.04 Server (Virtual Box) witch Tomcat and MySQL.
My structur of nested pages follows this sheme:
- Repair Manual
** Lenovo T570 Laptop
*** swap HDD
*** swap RAM
*** add RAM
** Lenovo X380 Yoga
*** etc.
For example, the new created/editable nested page should be created at “swap HDD”.
My code-base so far. (DON’T WORK!)
{{velocity}}
#if("$!request.docName" != '')
## Request for creating a new instance
#set($targetDocReference = $services.model.createDocumentReference('', $!{request.spaceName}, $!{request.docName}))
$response.sendRedirect($xwiki.getURL($targetDocReference, 'inline', "template=${escapetool.url($request.template)}&parent=${escapetool.url($request.parent)}"))
## Stop processing, since we already sent a redirect.
#stop
#end
{{html}}
<input type="hidden" name="parent" value="${doc.fullName}"/>
<input type="hidden" name="template" value="XWiki.Tmpl_form_AA_03"/>
<input type="hidden" name="sheet" value="1"/>
<input type="hidden" name="spaceName" value="Repair Manual"/>
<form action="" id="newdoc" method="post">
working-step name: <input type="text" name="docName" value="for example: swap HDD" class="withTip" size="50"/>
<p></p>
<table>
<tr>
<th align="left">
Bild:
</th>
<th align="left">
short-description:
</th>
</tr>
<tr>
<td>
IMAGE HERE
</td>
<td>
<textarea name="short-description" id="short-description" cols="80" maxlength="500"></textarea>
</td>
</tr>
</table>
<table>
<tr>
<th>
</th>
<th align="left">
steps:
</th>
<th align="left">
needed tools:
</th>
<th align="left">
needed parts:
</th>
</tr>
<tr>
<td>
01:
</td>
<td>
<textarea name="step01" id="step01" maxlength="200"></textarea>
</td>
<td>
<textarea name="tool01" id="tool01"></textarea>
</td>
<td>
<textarea name="part01" id="part01"></textarea>
</td>
</tr>
<tr>
<td>
02:
</td>
<td>
<textarea name="step02" id="step012" maxlength="200"></textarea>
</td>
<td>
<textarea name="tool02" id="tool02"></textarea>
</td>
<td>
<textarea name="part02" id="part012"></textarea>
</td>
</tr>
</table>
<span class="buttonwrapper"><button type="button" id="add new step">neuen Schritt hinzufügen</button></span>
<span class="buttonwrapper"><button type="button" id="delete last step">letzten Schritt löschen</button></span>
<p></p>
<span class="buttonwrapper"><input type="submit" value="save" class="button"/></span>
</form>
{{/html}}
{{/velocity}}