Unhiding the hidden 'hidden input' control in XPages
Tags : Lotus Domino XPages
Bookmark :
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.
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.
Bookmark :
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.
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
In case you're curious, the tag name for that control is xp:scriptBlock.
Posted by Tim Tripcony At 03:49:58 PM On 10/20/2009 | - Website - |
Posted by Peter Presnell At 05:59:56 PM On 10/20/2009 | - Website - |
-John
Posted by John Mackey At 08:06:37 PM On 10/20/2009 | - Website - |
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.
Posted by JJTB Somhorst At 03:37:38 PM On 01/20/2010 | - Website - |
- Thanks for the bar-none most excellent XPages blogging, Declan! I'd be unable to do XPages without your guidance.
Posted by David Gilmore At 12:12:59 PM On 01/21/2010 | - Website - |