onCustomFieldsPrepareDom add aditional DOM. But it does not show. What am I doing wrong? Is this the wrong way to do it? Thanks

57 views
Skip to first unread message

Sven Schultschik

unread,
Sep 4, 2018, 3:49:33 PM9/4/18
to joomla-de...@googlegroups.com
Hi,

I try to add two additional DOM elements to a field.

public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
{
$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

// Execute only if we had a jtfileupload
if ($field->type != 'jtfileupload')
{
return $fieldNode;
}

if (!$fieldNode)
{
return $fieldNode;
}

$fieldNode->setAttribute('accept', '.pdf,.PDF');

//Edit? File already exist?
if (!empty($field->value)){
$fieldNode->setAttribute('display', 'none'); //Wirkt nicht warum?
$fieldNode->setAttribute('disabled', 'disabled');

$domDoc = $parent->ownerDocument;
$fileName = $domDoc->createElement("span",$field->value);

$fieldNode->parentNode->appendChild($fileName);
$parent->appendChild($fileName);
}

return $fieldNode;
}
Reply all
Reply to author
Forward
0 new messages