Merge pull request #1507 from victorsl/BUG-11141
BUG 11141 "Javascript doesn't execute when you open a..." SOLVED
This commit is contained in:
@@ -5499,6 +5499,32 @@ class xmlformTemplate extends Smarty
|
||||
*/
|
||||
public function printJSFile (&$form)
|
||||
{
|
||||
//JS designer>preview
|
||||
if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER["HTTP_REFERER"]) && preg_match("/^.*dynaforms_Editor\?.*PRO_UID=.*DYN_UID=.*$/", $_SERVER["HTTP_REFERER"]) && preg_match("/^.*dynaforms\/dynaforms_Ajax.*$/", $_SERVER["REQUEST_URI"])) {
|
||||
$js = null;
|
||||
|
||||
foreach ($form->fields as $index => $value) {
|
||||
$field = $value;
|
||||
|
||||
if ($field->type == "javascript" && !empty($field->code)) {
|
||||
$js = $js . " " . $field->code;
|
||||
}
|
||||
}
|
||||
|
||||
if ($js != null) {
|
||||
$form->jsDesignerPreview = "
|
||||
//JS designer>preview
|
||||
$js
|
||||
|
||||
loadForm_" . $form->id . "(\"../gulliver/defaultAjaxDynaform\");
|
||||
|
||||
if (typeof(dynaformOnload) != \"undefined\") {
|
||||
dynaformOnload();
|
||||
}
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
$this->assign( 'form', $form );
|
||||
$this->assign( 'printTemplate', false );
|
||||
$this->assign( 'printJSFile', true );
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
sub.sendObj = false;
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{foreach from=$form->fields item=field key=name}
|
||||
i = myForm.aElements.length;
|
||||
|
||||
@@ -175,7 +176,13 @@
|
||||
{/if}
|
||||
{/foreach}
|
||||
{literal}}{/literal}
|
||||
|
||||
{if (isset($form->jsDesignerPreview))}
|
||||
{$form->jsDesignerPreview}
|
||||
{/if}
|
||||
{if $printJavaScript}
|
||||
leimnud.event.add(window,'load',function(){literal}{{/literal}loadForm_{$form->id}('{$form->ajaxServer}');if (typeof(dynaformOnload) !== 'undefined') {literal}{dynaformOnload();}}{/literal});
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if $printJavaScript}
|
||||
leimnud.event.add(window,'load',function(){literal}{{/literal}loadForm_{$form->id}('{$form->ajaxServer}');if (typeof(dynaformOnload) != 'undefined') {literal}{dynaformOnload();}}{/literal});
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm name="_options" type="grid" width="100%" editRow="0" insertRow="0">
|
||||
<NAME type="text" validate="Field" size="25">
|
||||
<NAME type="text" validate="Field" size="19">
|
||||
<en>Value</en>
|
||||
</NAME>
|
||||
<LABEL type="text" size="25">
|
||||
<LABEL type="text" size="19">
|
||||
<en>Label</en>
|
||||
</LABEL>
|
||||
<OPTGROUP type="checkbox" value="1" falsevalue="0" defaultvalue="0">
|
||||
|
||||
@@ -123,7 +123,7 @@ function gridOptionOptGroupColumn(show, swDelete)
|
||||
lblOptGroup = tableGrid.rows[i].cells[j].innerHTML;
|
||||
}
|
||||
|
||||
tableGrid.rows[i].cells[j].style.width = "20%";
|
||||
tableGrid.rows[i].cells[j].style.width = "25%";
|
||||
tableGrid.rows[i].cells[j].innerHTML = (show == 1)? lblOptGroup : "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user