Last modified: 2013-04-12 20:12:13 UTC
Referring to the "embed in field" and "holds template" fields. I use this functionality to allow the user to select a subset of fields to complete on a form based on a dropdown selection, e.g., published work citations (news, journal, book, etc.). But, the requirement to keep the selector dropdown at the bottom of the form (below the templates that use it) isn't standard and may look weird to those picky/critical users. Most users would expect the selector to come first (top-to-bottom, left-to-right). I'm sure there is a technical reason for the way it is now, but a fix would be nice.
I'm not sure I fully understand. What's an example of a form definition that you wish were laid out differently?
The instructions for 'embed in field' say: Note that the template to be embedded must appear after the template in which it will be embedded. Which is true because it only works with the dropdown coming after the template that uses it, like so: {{{for template |CreateRefObject |sourceType={{SusFormType |sourcetype}} }}} <div class="create-form-section-inner" id="journal-article-form"> ===Cite Journal Article=== {{{field |sourceType |holds template |hidden}}} {| ! | Author*: | {{{field|journal-author}}} |} </div> <div class="create-form-section-inner" id="news-article-form"> ===Cite News Article=== {{{field |sourceType |holds template |hidden}}} {| ! | News Author*: | {{{field|news-author}}} |} </div> {{{end template}}} {{{for template |SusFormType |embed in field=CreateRefObject[sourceType] |label=Source Type}}} {| ! Select the type of source to cite*: |{{{field|sourcetype|input type=dropdown |default=News Article |values=News Article, Journal Article,Video |show on select=News Article=>news-article-form; Journal Article=>journal-article-form; Video=>video-form|mandatory }}} |} {{{end template}}} If you place the "{{{for template |SusFormType..." form first, the templates that use it don't get the value.
There are two strange things going on in this form: - You have two "field" tags for the same template field - that's not allowed. (I'm surprised this worked for you.) - You're embedding a non-multiple-instance template; as far as I know, there's no reason to do that. Why not just add that one field to the "CreateRefObject" template?
You're right. The strange things are removed and all is well. Thanks for your patience Yaron.