Im using orbeon 4.10 to collect data and fill back a PDF from a template. I would like to choose how the time is displayed on the pdf. I have seen the oxf.xforms.format.input.time and oxf.xforms.format.output.time properties, but they seem to only control the form itself.
I have also seen this, but it seems to relate to the date format.
What value do I need to change in my properties?
Thanks
UPDATE: I don't think my solution below actually works. I think this might have worked at some point but might not work anymore. We do have an RFE for this.
You can use the following property:
<property
as="xs:string"
name="oxf.fr.resource.$app.$form.$lang.print.formats.time"
value="[H01]:[m01]:[s01]]"/>
where:
$app is the app name
$form is the form name
$lang is the language which applies
You can use wildcards (*) for all of those.
As a workaround i used a Hidden field to format my time correctly for the pdf.
Here is the formating code :format-time($controlname, '[H01]:[m01]') that i used in the calculated value
Here is the visibility code : $fr-mode = 'email' for the pdf generated from email or $fr-mode = 'pdf' for pdf button.
Related
I found this similar question How to fill in a datetime-local field with capybara?, and the only answer in this thread is not working. So I decided to open this question. It seems like there's no documentation or tutorial about this. Have any solution? It will be a great help!
The keys different browsers accept for setting a datetime input field are diffrent, however if you're using selenium with chrome and you are actually attempting to fill in a visible <input type="datetime-local"> element, as your question states, then the answer in the question your linked to should work - Here is a gist that shows it working - https://gist.github.com/twalpole/a541746b354afde8e82fa89a35a9b2da
The important part in that answer is the format of the string you send since it needs to match the keys the browser is expecting for setting that input (to_json doesn't match that format)
Therefore, in your case of wanting to set DateTime.current it should be something along the lines of
fill_in 'id/name/label of input', with: DateTime.current.strftime("%m%d%Y\t%I%M%P")
If that doesn't work for you then most likely you're not actually attempting to fill a visible <input type="datetime-local"> field (maybe you're using some kind of JS widget that replaces/hides the input???) and you'll need to specify the exact HTML you are trying to fill in your question.
from what I understand, you need to fill in a string representation of the datetime format
examples of such dates are
1990-12-31T23:59:60Z
or
1996-12-19T16:39:57-08:00
so something like
fill_in datetimeinput, with: "1990-12-31T23:59:60Z"
should work (hope so!)
I am trying to format an input field of the type xs:date in Orbeon.
I have tried using the xxf:format attribute, but the datepicker can not understand the date when it has been modified.
The idea now was to change the javascript of Orbeon to use the xxf:unformat attribute to interpret the date and transform it back to ISO format.
I've tried changing the data.js but for some reason none of the changes can be seen.
Am I changing the wrong file?
Edit
I figured out that the xforms.js has a function 'getCurrentValue' which is being as the changes I do there are visible. Now I just need to figure out who is the one that's calling the function.
Edit:
It is the Calendar who requests the value of the input when the user clicks on the symbol. This all happens at the client side, and the generated HTML does not have the format/unformat attributes. However I want to use their value. Can I make a request to Orbeon to get it? How?
In case you're using an xf:input bound to a node of type xs:date, you can control the formatting of the date field with the oxf.xforms.format.input.date property. A few formats are supported, and if you want to add more, the best would be to follow the pattern currently used for the currently supported formats.
E.g.
[M]/[D]/[Y]
[Y]-[M01]-[D01]
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>
I'm trying geodjango for my pet project and everything looks good with an exception...
In my model I have a field like this:
coordinates= models.PointField(srid=4326,default='POINT(0.0 0.0)')
and my admin extends from admin.OSMGeoAdmin but when I open a new model instance in the admin, I'm not seeing the '0.00,0.00' point selected in the map and if I try to save the document, I'll get 'No geometry value provided'. Like if the admin just Can't put the point in the map.
Also, if I try using the shell, I can save instances w/o problem and get the field with the default value POINT(0.0 0.0).
Am I missing something in the admin?
Thanks for any hint!
I have the same issue.
It's weird. What is getting POSTed makes no sense.
At the point of hitting submit the textarea has the correct geometry value (as I put an onsubmit on the form that outputs me this value).
But what gets submitted is not that value.
So I turned JS off... wow. The correct value is submitted and I am a little happier, but this is not a solution.
But what javascript is doing this I don't know.
I've tried this with Django 1.3 and 1.4.
Have you had any luck?
update. one more 'solution'... override openlayers.html and turn the textarea to a standard text input. wow. works again.
SOLVED!
So mine took some digging... but my admin uses tinymce... Tinymce works on textareas yeah.... well it screwed up the widgets textarea, but ever so silently.
editor_deselector : "vWKTField"
Well, after toying around with open layers.html (THANKS noisyboiler!) I found there is an attribute on the OSMGeoAdmin display_wkt, setting it to True will show the textArea without hacking the template.
For entries with existing points, it contains a value in this format:
SRID=3857;POINT(890338.8453418 -1109499.0330941)
So I just change my Point Field to:
coordinates= models.PointField(srid=4326,default='SRID=3857;POINT(0.0 0.0)')
What I understand from Spherical Mercator is that 4326 is for two-dimensional maps, but seems like google Maps uses 3857 which includes a spherical projection.
Now works!
Is there a way in Orbeon to save TextAreas and RTEs as CDATA sections so that line breaks and other formatting inputted by the user is preserved? In some use cases it's really important not to change what the user has entered and I haven't found a way to accomplish this to date.
Thanks!
In general, formatting and line breaks should be preserved by default. If the input is modified, there are three possible "culprits": the RTE component itself, Tagsoup, and clean-html.xsl. There are certain limitations regarding the RTE component (AFAIK orbeon still uses YUI 2), for example it doesn't handle p elements correctly. Tagsoup and clean-html.xsl should let through most of the standard html elements, but they filter, for example, the canvas element. More on orbeon's RTE element:
http://wiki.orbeon.com/forms/doc/developer-guide/xforms-controls/textarea-control#TOC-Rich-text-editor-HTML-editor-
So, if the content that arrives at your xforms instance is modified, you will need to debug each of the processing steps to check where the modification took place.
If it's a matter of the RTE component, you could try to check if the TinyMCE XBL component works better for you (it uses TinyMCE instead of the YUI2 RTE - i posted it some months ago in the ops-users ML). If it's a Tagsoup matter, you will have to patch the source code (change the Tagsoup config); there's also a workaround to configure Tagsoup using an external config file (it should be available in the ML archives, too). If it's a clean-html.xsl issue, you can easily created your own clean-html.xsl, it's described in the wiki page (see above) HTH fs