Skip to content

First step for integration with more complex fields#6

Open
vlad-ghita wants to merge 3 commits into
nickdunn:masterfrom
vlad-ghita:master
Open

First step for integration with more complex fields#6
vlad-ghita wants to merge 3 commits into
nickdunn:masterfrom
vlad-ghita:master

Conversation

@vlad-ghita
Copy link
Copy Markdown

Hi, Nick.

I adjusted the templates to accept more generic handles. This means that postback values can be persisted even for more complex fields (Date/ Time, Multilingual *).

Classic handle

<xsl:call-template name="form:input">
     <xsl:with-param name="handle" select="'name'"/>
</xsl:call-template>

=> handle="fields[name]"

Improved handle

 <xsl:call-template name="form:input">
     <xsl:with-param name="handle" select="'name/value-ro'"/>
 </xsl:call-template>

=> handle="fields[name][value-ro]"

handle now accepts a sort of xPath: parent-node/node/....

There is a special use-case for Date/Time field. It needs something like fields[date][start][] to work. In order to generate it, use like this:

 <xsl:call-template name="form:input">
     <xsl:with-param name="handle" select="'date/start/ '"/>
 </xsl:call-template>

=> handle="fields[date][start][]"

Notice the extra space afterdata/start/. It's the only soultion I could think of.

At these lines I don't know what's going on so I didn't update them (I don't have a test environment for it). You should have a look and adapt them . The form:postback-find-value might be useful.

Regards,
Vlad

@vlad-ghita
Copy link
Copy Markdown
Author

Latest commit requires an extra attribute to be passed to error elements:

<error handle="subiect" for="{concat('subject/value-', $language)}" type="missing">

The for attribute will match the handle of the targeted form element. handle will refer to the error element in XML returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant