How to define dynamically the label of a 'text field' control in Orbeon Forms? - orbeon

I wish to ask you if it is possible to define dynamically the label of a 'text field' control when a form is loaded. Actually, I need to pass the label value through a URL parameter and use this value to define the label. Is that possible? I've made a research for a similar case but I cannot find a way to get the value of a url parameter and set it as a control's label before the form is displayed in the user.
Regards,
George

In the Control Settings for your control, in the Label tab, do something as follows. Here I'm getting the value of the foo request parameter, but you'll most likely want to use a more meaningful name.
That's it, really: with this, when you load your form, say with the URL http://localhost:8080/orbeon/fr/a/a/new?foo=bar, the control will get "bar" as its label. Also see Template syntax.

Related

Orbeon forms convert number from textfield into words?

i am creating orbeon form, so i write a script that can convert number into words,now is it possible to pass the parameter url in orbeon to read a text field and convert the number in to word in another textfield or populate another textfield from the url?
I'm not sure what you need. If you need get URL parameter you can use xxf:get-request-parameter() (https://doc.orbeon.com/xforms/xpath/extension-functions/extension-http#xxf-get-request-parameter). For example set this funciton as calculated value for some Text Field, publish form and test it in Runner.
If it not correct answer, please write more information about you problem.

How to load contact field token in email template based on condition

I want to show the contact first name in the e-mail, but if the first name field is empty I want to show some other field. Is this possible?
Something like this:
Hi {contactfield=firstname} or if empty {contactfield=email}
Thank you in advance.
Yes it is possible, you can use "Dynamic Content" option available in slot type. it allows you to use variations in the content based on value of the the field.
simply add the slot, then put in a default value, click Add Variant and at the bottom right you can choose the field and comparison option.

How to reset the field value on a custom form field?

I have a custom field in Jira and I want to set the value on the field to match the current user.
This seems as though it should be fairly easy, but it has stumped me. I have trawled for information and have been led to using post functions.
Post functions don't seem to actually pre-set the value of fields on the create issue screen unfortunately? I am able to set a value which appears on the issue once it is created using a post function but I cant seem to find a way to set the value on the form itself.
Is this possible?
There is Default Values for 'Create Issue' screen plugin which seems to be doing exactly what you want.

xpages reader field with - read only type

I have question:
My xpages contain a field that contain creator of document.
The issue is:
When ReadOnly field is Enabled, the agent can't get value of the field from context.
I want user can't change the value of the field
How to solve it?
Note: there a button that will call the agent to process the context
Thank you for your help
Why not to use the disable property of the inputText? And with a little help of CSS the result might be just fine:
<xp:inputText id="inputText1"
style="background-color:none;border:none;background: transparent"
disabled="true">
....
</xp:inputText>
Or you can compute the disable property:
<xp:this.disabled><![CDATA[#{javascript:if (currentDocument.isEditable())
return true;}]]></xp:this.disabled>
Hint: I recommend to create a .css file and write there all the properties. Then just import the file to the respective xpage/custom control and specify the class in the Style property of the field.
First of all: it isn't very clear what you want to do. You have a field with the creator of a document and you speak of an agent. A few pointers:
Never try to process UI elements. Always go after the data model, the bound data.
Displaying a username doesn't write it back anywhere, you need to take a different action. Add to the "post new document" event something like:
var creator = document1.replaceItemValue("Creator",#UserName);
creator.setAuthors(true);
(above is off my head, might contain typos). Then the value is in the document, you can use it in a computed field and hand it over to an agent (which I wouldn't do, convert your agent code to Java and clean it up while you are on it).
Do you mean something like this?
<xp:inputText id="inputText1" defaultValue="test">
<xp:this.attrs>
<xp:attr name="readonly" value="true"></xp:attr>
</xp:this.attrs>
</xp:inputText>

How can I add text to a work item

We have a few bugs and change requests which have a complicated iteration path. This results in people coming over the team to ask 'Where do we raise items' a lot.
As you can't set a default value for the iteration path in TFS 2010 we think the best solution would be to add a string of text under the field which we can manually update every 7 weeks with the correct area to raise items in.
However TFS doesn't seem to allow just a line of text on its work items as a control. Is there a way to add a line of display text i.e. Not a field you edit, but just to inform those writing the items?
Please note that it needs to be visible at all times, using the tooltip 'help text' field on a control is not enough in this case.
You can use the LabelControl for this purpose.
You can not have a default in the work item for the iteration path, but what you can do is making use or the template url in web access or the work item templates in the power tools to create a work item that is prepopulated with values.
What about a custom field with a display control in read-only? You can give a default value to the field and the "read-only" control prevent other to change it.

Resources