Inline validation with Form Controls
This is an open discussion with 2 replies, filed under Extensions.
Search
Nice. Glad to see someone using Form Controls. It’s been a while since I’ve had a chance to play around with this. See if you can glean anything from my experiments with my Form Builder ensemble. I was playing around with combining Section Schemas and Form Controls to dynamically rebuild the Symphony admin as front end forms.
It’s so nice to see others having the same ideas. I’ve also noted in the back of my mind to make some combination of Section Schemas and Form Controls. That is, I’ve already experimented with some simple templates for my needs thus far:
<xsl:template match="section-schema/*[@type = 'input'] | section-schema/*[@type = 'date']"> <xsl:variable name="field" select="name()" /> <div> <label for="fields-{$field}"> <xsl:value-of select="$lstrings/label[@key = $field]" /> </label> <xsl:call-template name="form:input"> <xsl:with-param name="handle" select="$field" /> </xsl:call-template> </div> </xsl:template> <xsl:template match="section-schema/*[@type = 'textarea']"> <xsl:variable name="field" select="name()" /> <div> <label for="fields-{$field}"> <xsl:value-of select="$lstrings/label[@key = $field]" /> </label> <xsl:call-template name="form:textarea"> <xsl:with-param name="handle" select="$field" /> <xsl:with-param name="rows" select="size" /> <xsl:with-param name="cols" select="'50'" /> </xsl:call-template> </div> </xsl:template>
(The $lstrings variable contains language strings dynamically loaded based on $url-language from the Language Redirect extension). But there’s a lot of improvement to be done in simplifying the invocation of this, and further combining validation. In our open source webapp framework, Kolibri, we have some cool meta-XSLT I wrote to generate form fields with validation errors from models. So I’m going to try loan some ideas from that for Symphony projects as well.
Create an account or sign in to comment.
I’m using Mr Dunn’s excellent Form Controls XSL in my current project. I’ve added a (very simple) method of including inline validation for fields.
I call it like so:
I’m certainly no XSL ninja, and there’s probably a cleaner way to do this. For starters, I’d like to not have to pass ‘$form:event’ in each time. Can anyone show me how to do this?