Skip to content

Instantly share code, notes, and snippets.

Avatar

rico goldsky

View GitHub Profile
@goldsky
goldsky / chunkToJsProperty.php
Created Jun 20, 2014
Output modifier to escape HTML for javascript's value
View chunkToJsProperty.php
<?php
$output = $input;
$output = str_replace('/', '\/', $output);
$output = str_replace("\n", '', $output);
$output = preg_replace("/(>+(\s)*<+)/", '><', $output);
$output = preg_replace("/\s+/", ' ', $output);
return $output;
@goldsky
goldsky / step1DynamicFields.wrapper.html
Created Jun 20, 2014
Wrapper chunk for step-1 field of dynamic field for FormIt
View step1DynamicFields.wrapper.html
[[+dynfield.items]]
<script>
function addRow(button) {
var newRow = '[[$step1DynamicFields.item:chunkToJsProperty]]' + "&nbsp;\n";
$(newRow).insertBefore($(button));
}
function removeRow(button) {
$(button).parent().parent().remove();
}
</script>
@goldsky
goldsky / step1DynamicFields.item.html
Created Jun 20, 2014
Row chunk for step-1 field of dynamic field for FormIt
View step1DynamicFields.item.html
<div class="input-group">
<input
name="telephone[]"
type="text"
value="[[+dynfield.telephone]]"
placeholder="+1 800 123456"
required="required"
class="form-control required"
>
<span class="input-group-btn">
@goldsky
goldsky / step-1.html
Last active Aug 29, 2015
Page 1 of dynamic field for FormIt
View step-1.html
[[!FormIt?
&hooks=`redirect`
&store=`1`
&redirectTo=`9`
&validate=`name:required,
telephone:required`
&submitVar=`go`
]]
[[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
<form action="[[~[[*id]]]]" method="post" class="form-horizontal" role="form">
@goldsky
goldsky / step2DynamicFields.item.html
Created Jun 21, 2014
Row chunk for step-2 field of dynamic field for FormIt
View step2DynamicFields.item.html
<div class="input-group">
<input
name="position[]"
type="text"
value="[[+dynfield.position]]"
placeholder="Past position"
required="required"
class="form-control required"
>
<span class="input-group-btn">
@goldsky
goldsky / step2DynamicFieldsEmail.item.html
Created Jun 21, 2014
Row template for fiDynamicFieldsEmail snippet to revert dynamic field in step-2
View step2DynamicFieldsEmail.item.html
<li>[[+dynfield.position]]</li>
@goldsky
goldsky / step2DynamicFieldsEmail.wrapper.html
Created Jun 21, 2014
Wrapper template for fiDynamicFieldsEmail snippet to revert dynamic field in step-2
View step2DynamicFieldsEmail.wrapper.html
<tr>
<td>Positions</td>
<td>:</td>
<td><ul>[[+dynfield.items]]</ul></td>
</tr>
@goldsky
goldsky / step2DynamicFields.wrapper.html
Created Jun 21, 2014
Wrapper chunk for step-2 field of dynamic field for FormIt
View step2DynamicFields.wrapper.html
[[+dynfield.items]]
<script>
function addRow(button) {
var newRow = '[[$step2DynamicFields.item:chunkToJsProperty]]' + "&nbsp;\n";
$(newRow).insertBefore($(button));
}
function removeRow(button) {
$(button).parent().parent().remove();
}
</script>
@goldsky
goldsky / emailTpl.html
Last active Aug 29, 2015
Example of email template when using dynamic field for FormIt
View emailTpl.html
<p>Hello Admin,</p>
<p>Someone has sent the application form.</p>
<table style="border: none;">
<tr>
<td colspan="3">Personal Details</td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
@goldsky
goldsky / step1DynamicFieldsEmail.item.html
Created Jun 21, 2014
Row template for fiDynamicFieldsEmail snippet to revert dynamic field in step-1
View step1DynamicFieldsEmail.item.html
<li>[[+dynfield.telephone]]</li>