Loading from XML - Syntax problem

Hello,

I am having a problem working out the proper syntax to create a link on a dynamically created form.

If I create the form manually, I can create a label with a link like this:

{type:"block", list: [ {type:"label", label:"<a href='http://dhtmlx.com/docs/company.shtml' target='_blank'>Company</a>"},

That works correctly. However, I am creating the form dynamically through a php script which builds an XML string which I then load using the loadStruct method. Creating a label this way looks like this:

$xmlStr .= '<item type="block">'; $xmlStr .= '<item type="label" label="Company"/>';

Now, I want to add the link to that label. The documentation gives this example:

<item id="company" text="Company"> <href target="blank"><![CDATA[dhtmlx.com/docs/company.shtml]]></href> </item>

So, to create this dynamically, I thought it would be as simple as this:

$xmlStr .= '<item type="block">'; $xmlStr .= '<item id="company" text="Company"><href target="blank"><![CDATA[dhtmlx.com/docs/company.shtml]]></href></item>';

but that does not work. I’ve tried a number of variations of this without success. I’m sure it’s just a simple syntax issue, but I’m having trouble spotting it.

It is not available to use the CDATA in this case.
Please, try to use the following solution

Here is the working example:
snippet.dhtmlx.com/2582b355a

Thanks, that got me on the right track. I had to modify your code a bit. The following worked for me.

$xmlStr .= '<item type="label" label="<a href='http://dhtmlx.com/docs/company.shtml' target='blank'> Company </a>"/>';