« xTalk Is on OpenNTF | Main| Lotus Awards For OpenNTF and GPL Submissions »

Unhiding the hidden 'hidden input' control in XPages

Tags : Lotus Domino XPages
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

There is a new control type in 8.5.1 that for some reason is hidden and this is the 'Hidden Input' control. When doing web development it is quite common to include hidden fields on a webpage that are then submitted to the server. In XPages on 8.5.0 there was no easy way to do this, you could create a field and then hide it using CSS but that is not a great solution as when CSS is disabled the field becomes visible.

In XPages in IBM Lotus Domino 8.5.1 you can now directly add hidden input fields to your webpage but the control is not listed with the rest of the core controls, you have to use the 'Other' option to select the 'Hidden Input' control or you can turn it on permanently in the Domino Designer preferences. I've highlighted below where to find it.

A picture named M2

You can bind a hidden input to a field in a Notes document in XPages just like you would a normal input and you can write client side javascript and server side javascript to access and change the contents of the field. I'm using this in the name picker in xTalk. When the page where the name picker is shown some client side javascript takes the values in the listbox, puts a semi-colon between the values and adds them as a single string to the hidden field which is bound to a field in the Notes document. The server side javascript then converts the field into a READERS or AUTHORS field as required by the code.

In the screenshot above you might also notice a few other controls that are not enabled by default, they are mostly select explanatory like Line Break, Span, Paragraph and Block Content ( DIV ). I'm still investigating what Output Script does. I'll blog again once I know.

Comments

Gravatar Image1 - Output Script just adds an inline script tag to the body. It's a way of adding a block of page-specific script (as opposed to having to define it in a script library or other separate script file).

In case you're curious, the tag name for that control is xp:scriptBlock.

Gravatar Image2 - How appropriate that the hidden input control was hiden from us all. Great find Declan, my last Xpage Blog is in need of an update.

Gravatar Image3 - Very nice Declan!

-John

Gravatar Image4 - It's a very nice 'feature' which I'm using alot aswell in my code applications.

Just be aware that the stuff you can put in using client side javascript can also be changed by users ( using firebug for instance ) before submitting to youre server which also needs serverside validation of that data.

Altrough it works great I sometimes have difficulties with the hidden input. When I update the field value with client side javascript its not always saved to the backend notes document without generating errors its just not saved.

Gravatar Image5 - - My experience is that a hidden field, even one bound to a field on a XPage, can't be accessed by JS. How does one do this? I'm working on dijit dialogs and I have to specify the fields are visible, with a style of display:none, or the dialog can't find it.
- Thanks for the bar-none most excellent XPages blogging, Declan! I'd be unable to do XPages without your guidance.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)