Skip to content

Commit

Permalink
Merge branch 'release-branch'
Browse files Browse the repository at this point in the history
  • Loading branch information
buttflattery committed Feb 23, 2020
2 parents 2bae74e + d8ca9ec commit 1de25e2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/FormWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ class FormWizard extends Widget
*/
public $enablePreview = false;

/**
* Label used for the empty input in the preview step, default `NA`
*
* @var string
*/
public $previewEmptyText = 'NA';

/**
* Enables restoring of the data for the unsaved form
*
Expand Down Expand Up @@ -1026,6 +1033,7 @@ public function registerScripts($pluginOptions, $isBs3, $jsOptionsPersistence)

//encode plugin options
$pluginOptionsJson = Json::encode($pluginOptions);
$previewEmptyText=$this->previewEmptyText;

//register inline js
//add tabular events call back js
Expand Down Expand Up @@ -1057,6 +1065,7 @@ public function registerScripts($pluginOptions, $isBs3, $jsOptionsPersistence)
//fields list
$.formwizard.fields.{$this->formOptions['id']}={$fieldsJSON};
$.formwizard.previewHeadings={$headingsJSON};
$.formwizard.previewEmptyText="{$previewEmptyText}";
$.formwizard.options.{$this->formOptions['id']}={
wizardContainerId:'{$wizardContainerId}',
Expand Down
5 changes: 3 additions & 2 deletions src/assets/js/formwizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $.formwizard = {
observerObj: null,
fields: [],
previewHeadings: [],
previewEmptyText:'',
options: [],
submit: false,
helper: {
Expand Down Expand Up @@ -203,8 +204,8 @@ $.formwizard = {
let inputLabel = $.formwizard.previewStep.getLabel(fieldName);
let inputValue = $.formwizard.previewStep.getValue(formId, fieldName);
let stepData = {
"label": inputLabel == '' ? 'NA' : inputLabel,
"value": inputValue == '' ? 'NA' : inputValue,
"label": inputLabel == '' ? $.formwizard.previewEmptyText : inputLabel,
"value": inputValue == '' ? $.formwizard.previewEmptyText : inputValue,
"target": fieldName
};

Expand Down
Loading

0 comments on commit 1de25e2

Please sign in to comment.