Skip to content

Commit

Permalink
Fixed issue with digsig element in repeat groups - the setJoinData()
Browse files Browse the repository at this point in the history
form model method automatically json decodes data, but digsig data needs
to stay encoded.  For now, re-encoded it within digsig, but should
probably have an element model isJSONData() or some such which defines
whether an elements data should be decoded or not.  Also updated digsig
JS library.
  • Loading branch information
cheesegrits committed Dec 1, 2015
1 parent b05e8c0 commit a1e41b1
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 8 deletions.
15 changes: 14 additions & 1 deletion plugins/fabrik_element/digsig/digsig.php
Expand Up @@ -59,6 +59,12 @@ public function render($data, $repeatCounter = 0)
$digsig_width = $params->get('digsig_form_width', '400');
$digsig_height = $params->get('digsig_form_height', '150');
$val = $this->getValue($data, $repeatCounter);

if (is_array($val))
{
$val = json_encode($val);
}

$basePath = COM_FABRIK_BASE . '/plugins/fabrik_element/digsig/layouts/';
$layoutData = new stdClass;
$input = $this->app->input;
Expand Down Expand Up @@ -283,7 +289,14 @@ public function elementJavascript($repeatCounter)
$sig_id = $id . '_sig';
$opts = $this->getElementJSOptions($repeatCounter);
$data = $this->getFormModel()->data;
$opts->value = htmlspecialchars_decode($this->getValue($data, $repeatCounter));
$opts->value = $this->getValue($data, $repeatCounter);

if (is_array($opts->value))
{
$opts->value = json_encode($opts->value);
}

$opts->value = htmlspecialchars_decode($opts->value);

if (empty($opts->value))
{
Expand Down

0 comments on commit a1e41b1

Please sign in to comment.