Hidden fields in XPages are not saved

When I use dome hidden edit boxes in XPages to calculate some necessary hidden values like flags 0, 1 etc or strings lile “draft”, “in work” is the hidden value not saved.

The values have to be hidden and saved and something like an " cannot be used in XPages.

Any idea how to get these values keeping the edit boxes hidden ? I tried the same with hidden computed fields and I encountered the same problem.

Any help is highly appreciated.

Subject: create them in the querysave event

A hidden control won’t be saved since it is not even rendered to the browser. Either use an event (postnewdocument?) and server side JavaScript to create your fields or create the fields on your Notes form and use the computewithform option to run the formulas on the Notes form when saving the data source.

Howard

Subject: Hide them with CSS…

  • Then if you set them using CSJS their data should remain, at least it does for me.

Hope this helps…

Subject: Use Xpage markup and then attach them to the document data source

First off we do this, so I can confirm it is possible. David suggested hiding with CSS, which is what I did in 8.5 before hidden inputs were available, but depending on how sensitive the data is you may not want to do that. The user can turn of css styling and see the information then.

By the looks of the code, you’re trying to use standard html markup rather than using XPage markup.

In your example, you’ve got

In Xpage markup it should be something more like (where data_document is the data source you defined and ‘default value’ is your SS javascript code to calculate it’s default value):

<xp:inputHidden value=“#{data_document.deletionFlag}”

id="deletionFlag" defaultValue="#{javascript:defaultvalue}">

</xp:inputHidden>

The hidden input control isn’t listed under core controls palette by default, but you can access it by going to: controls(palette)>other>(select where to place it on the xpage)>Core Controls>Hidden input.

Once that’s done you have a properties GUI underneath it and you can treat it like a normal XPage input controls. This won’t be rendered at all but will be sent to your document upon submission.

Hope that all makes sense :slight_smile:

Subject: This is an excellent idea…

  • But if it’s not rendered it won’t work with CSJS. Now perhaps Ionut doesn’t need to use CSJS, in which case I would definitely do this solution because of the caveats you mention, Neemesh. Sadly I require CSJS access to the fields, so I use CSS hiding.

  • But maybe I’m missing something. This would be an excellent opportunity for someone to point that out to me. (grin)

Thanks for your time…