Unhiding the hidden ‘hidden input’ control in XPages

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.

Tagged with: , ,
Posted in None
5 comments on “Unhiding the hidden ‘hidden input’ control in XPages
  1. Tim Tripcony says:

    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.

    Like

  2. Peter Presnell says:

    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.

    Like

  3. John Mackey says:

    Very nice Declan! -John

    Like

  4. JJTB Somhorst says:

    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.

    Like

  5. David Gilmore says:

    – 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.

    Like

Comments are closed.

Archives