nickdunn / form-controls Goto Github PK
View Code? Open in Web Editor NEW[Symphony 2] An XSLT utility to create powerful HTML forms with Symphony Events
[Symphony 2] An XSLT utility to create powerful HTML forms with Symphony Events
Hello nick,
I have a question about this great tool. This utility appends the attributes title
and value
without any value by default?
Here is my template. Check out the result http://pastie.org/644087.
If the value wasn't defined it's not necessary to append these attributes, right?
Thanks in advance!
when using a select box link with the following code (using section schemas):
<xsl:call-template name="form:select">
<xsl:with-param name="handle" select="name()"/>
<xsl:with-param name="options">
<option value="">Select a Country</option>
</xsl:with-param>
</xsl:call-template>
With this XML:
no
Health
Firefly
Entertainment
Symphony
I get the following error:
XSLTProcessor::transformToXml(): xsl:attribute : node already has children
Hi, first thanks a lot for your great job on form control, I'm working on a site with hundreds of form and I would certainly become mad without this utility.
I think I found a bug when submitting multiple entries of the same section with eventEx.
Let call the section 'mySection', the different entries submitted are 'mySection[0]' and 'mySection[1]'.
If the returning eventEx event contains error, then the first entry of the section ('mysection[0]') is not autopopulated as it should be.
I've been looking in the form control code, and I found out that the probleme was coming from line 1082 to1090 :
test="$event/entry[@section-handle=$section-handle and @index-key=$index-key]/post-values/[name()=$handle]/ "
This condition is never true for the firs entry (index-key=0). For a reason that I can not figure out, the @index-key is not available in the xml for this entry ( maybe this is an eventEx issue then?? ).
Do you have an idea about this issue ?
Thanks
I have a section which uses SB(L) fields for relationships with other sections. The data source XML that's used for a Members select
frontend form field:
<members-titles>
<section id="22" handle="members-titles">Members titles</section>
<entry id="429">
<title handle="dr">Dr</title>
</entry>
<entry id="430">
<title handle="mr">Mr</title>
</entry>
<entry id="431">
<title handle="ms">Ms</title>
</entry>
</members-titles>
The readme for form-controls, form-select
:
Each node passed to this parameter will be converted to an HTML option element. If the node has an attribute of the following names:
handle
,id
,link-id
,link-handle
orvalue
; these will be used as the value attribute of the option element. If none of these attributes is found, no value attribute will be appended. As in the above example, to achieve an empty value for the field (for validation, for example) add an empty value attribute to an option.
Because the SB(L) XML output has the id
parameter on the parent of the node which I need to specify to the template, the ID number is not being assigned to the select
option
value
parameter.
I've tried editing the form:select
template to look for ../@id
, but am not having any joy. I've also tried assigning the entry
node in the parameter that's passed to the template, but then the title
text()
is not output for the option
text.
example xslt:
<xsl:call-template name="form:checkbox-list">
<xsl:with-param name="handle" select="'category'"/>
<xsl:with-param name="class" select="'checkbox'"/>
<xsl:with-param name="options">
<category>Amateur</category>
<category>Senior</category>
<category>Professional</category>
</xsl:with-param>
</xsl:call-template>
html output:
<label class="">
<input id="fields-category" class="" type="checkbox" value="Amateur" title="" name="fields[category][]">Amateur
</label>
<label class="">
<input id="fields-category" class="" type="checkbox" value="Senior" title="" name="fields[category][]">Senior
</label>
<label class="">
<input id="fields-category" class="" type="checkbox" value="Professional" title="" name="fields[category][]">Professional
</label>
I copied the example, but it didn't work. I needed to add <input name="action[NAMEOFEVENT]" type="submit" value="Submit" />
Nick, started using this for a new project. Really great stuff.
I've come across one limitation thus far which is that the form:textarea
template doesn't retain the linebreaks when populating the value. It's happening because of the normalize-space
functions use there, and is easily fixed by changing:
<xsl:variable name="initial-value" select="normalize-space($value)"/>
to:
<xsl:variable name="initial-value" select="$value"/>
However that causes there to be a discrepancy between the $postback-value
and the $initial-value
. Not sure of the best way to get around that—perhaps adding a param to the form:postback-value
template to allow the non-normalised value to be returned?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.