Comments? Feedback?

On our community mailing list: subscribe sending an email to ops-users-subscribe@ow2.org (content of subject/body doesn't matter), you'll get a response with the email to use to send your message to the community mailing list.

Rationale

XForms actions are very powerful for relatively simple tasks, but they do not have all the properties of a modern scripting language. For more complex actions within forms, it is valuable to offer support for JavaScript and other languages.

Status

2011-01-03: Very experimental JavaScript/CoffeeScript support in the code. API is not developed yet.

Use from the top-level

[TODO: top-level must also be able to include server scripts that expose functions]

Instance access

[TODO]

Idea:

API to return instance (could be same as instance() / xxf:instance())

returns a DOM which wraps around dom4j and is able to intercept mutation

user will typically use jQuery or similar to navigate DOM of instance

an XPath API could be provided as well and/or E4X support could be tried

Controls access

read control value

write control value

Actions

[TODO]

Standard XForms actions:

setvalue

insert/delete

dispatch

insert

load

message

rebuild/recalculate/revalidate

send

setfocus

setindex

toggle

Extension actions:

show/hide

invalidateInstance / invalidateInstances

joinSubmissions

NOTE: the client-side API already features the following methods:

ORBEON.xforms.Document.dispatch()

ORBEON.xforms.Document.getValue()

ORBEON.xforms.Document.setValue()

Functions

Standard XForms functions:

event

index

instance

Extension functions:

MIPs

readonly / relevant / required / valid / type

case

index

instance

invalidBinds

itemset

pendingUploads

lang

listInstances

listModels

propertiesStartWith

property

request

getRemoteUser

getRequestAttribute

getRequestHeader

getRequestParameter

getRequestPath

getScopeAttribute

getSessionAttribute

setRequestAttribute

setScopeAttribute

setSessionAttribute

isUserInRole

Standard functions that we probably don't need right away if at all:

context

current

digest

hmac

isCardNumber

property

related to XPath limitations

booleanFromString

choose

countNonEmpty

if

power

random

date/time

daysFromDate

daysToDate

localDate

localDateTime

months

now

seconds

secondsFromDateTime

secondsToDateTime

Extension functions that we probably don't need right away if at all:

binding

callXPL

componentContext

encodeISO9075 / decodeISO9075

docBase64

attribute / element

evaluateAVT

evaluateBindProperty

extractDocument

formatMessage

formURLEncode

mutableDocument

repeatNodeset

sort

bind

[TODO]

Storing and retrieving state

[TODO]

Rationale

Currently, XForms actions that need state must create XForms instances and store state into those. This is often cumbersome. Actions written in JavaScript that need to keep state information should be able to use JavaScript data structures.

Format should be limited to basic types and JSON (and possibly XML) so that state can be serialized and deserialized.

Ideas

Script can store state information into models, including local XBL models. For example:

model.state.foo = < JSON or XML >

Q: Should there be a way of creating JSON XForms instances? This would allow the following scenario:

JS/CS calls API to send submission

submission returns JSON

JS/CS consumes JSON

Issues with this:

a JSON instance would be "foreign" in XML land

no support for XPath bindings

no access from XPath except through special accessor functions

Either way, the ability for JS/CS to leverage xf:submission to call services and get data back, typically in JSON format, should be supported.