Skip to content

Instantly share code, notes, and snippets.

@goldsky
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldsky/7a361c250deefb02a209 to your computer and use it in GitHub Desktop.
Save goldsky/7a361c250deefb02a209 to your computer and use it in GitHub Desktop.
Page 2 of dynamic field for FormIt
[[!FormIt?
&hooks=`email,redirect`
&emailTpl=`emailTpl`
&emailSubject=`Submission - [[+name]]`
&emailTo=`me@example.com`
&redirectTo=`10`
&validate=`position:required`
&store=`1`
&submitVar=`go`
]]
[[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
<form action="[[~[[*id]]]]" method="post" class="form-horizontal" role="form">
<fieldset>
<legend>Experiences</legend>
<div class="form-group">
<label for="position" class="col-sm-2 control-label">Positions</label>
<div class="col-sm-4">
<!-- [[- this snippet will render back the dynamic fields if the submission returns fail ]] -->
[[!fiDynamicFields?
&itemTpl=`step2DynamicFields.item`
&wrapperTpl=`step2DynamicFields.wrapper`
]]
<button
type="button"
class="btn btn-warning btn-sm"
onclick="addRow(this);"
>
<span class="glyphicon glyphicon-plus"></span> Click to add more
</button>
<div class="validate">[[!+fi.error.position]]</div>
</div>
</div>
&nbsp;
<div class="row">
<div class="col-sm-4 col-sm-offset-2">
<input
type="submit"
name="go"
class="btn btn-success btn-sm"
value="Submit"
>
</div>
</div>
<!-- [[- this snippet receives the data from the previous submission ]] -->
[[!FormItRetriever]]
<!-- step 1 submission is being held again in here -->
<input type="hidden" name="name" value="[[!+fi.name]]">
<input type="hidden" name="telephone" value="[[!+fi.telephone]]">
</fieldset>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment