Make a new page hidden by default

Hi all,
we prepared new evidence of internal reports based on AWM (like FAQ application). Because there will be a lot of reports in the future we want to hide new created pages and navidation will be processed only via Livedata. Navigation works perfectly but we can’t enforce creating new pages based on application template to be hidden.
We put following velocity code into “Sheet” template of the class:

#set ($discard = $xwiki.getDocument($doc.fullName).setHidden(true))

But it doesn’t work.
Any suggestion?
Thanks

This is not exactly the document instance the sheet is modifying.

The way the sheet is setting values in the new/modified document is by going through the <form> entries. So the game is finding which request paremeter is corresponding to the hidden document field.

I did not tested but it should be something like:

#if ($doc.isNew())
{{html}}
<input type="hidden" name="xhidden" value="1"/>
{{/html}}
#end

This script is checking if you are creating a new document and if it is it inject a not visible entry in the form in charge of setting the document hidden field (xhidden) to 1 (which basically means true).

Hi,
thank you for tip - I had already tried this approach before because I used it for filling title, but unfortunatelly I don’t know the right name of hidden input elements. I studied posibilities here - but there is no tip/field should be used.
:sleepy:

Did you try the name Thomas suggested (xhidden)?

Yes - I’ve tried it but I didn’t succeded :frowning: see part of code:

{{html}}
  <form action="" id="newdoc" method="post">
    <div>
      <input type="hidden" name="parent" value="${doc.fullName}"/>
      <input type="hidden" name="template" value="${template}"/>
      <input type="hidden" name="sheet" value="1"/>
      <input type="hidden" name="spaceName" value="${spaceName}"/>
      <input type="hidden" name="xhidden" value="1"/>
...
{{html}}

Thomas,
sorry for my mistake - I put the code into wrong place. Finally your tip works.
Thank you for help.
Best regards

That’s reassuring :slightly_smiling_face: