Hi,
I’m initializing my dhxForm from Object and would like to set some input fields as readonly.
Is there any possibility?
Or could you please advise me how to modify dhtmlxfrom.js ?!
Thanks a lot!
Hi,
I’m initializing my dhxForm from Object and would like to set some input fields as readonly.
Is there any possibility?
Or could you please advise me how to modify dhtmlxfrom.js ?!
Thanks a lot!
It works fine! Thank you very much.
It was also possible to integrate a new function in dhtmlxform.js.
kind regards
Try the same example but loading data from a xml.
[code] function doOnLoad() {
var formData = [
{type: "input", name: "myInp1", label: "Read-only item", value: "Some text"},
{type: "input", name: "myInp2", label: "Read-write item", value: "Change me!"},
{type: "button", name: "myButton", value: "Submit"}
];
form = new dhtmlXForm("listObj", formData);
form.loadStruct("xml/detalle_medios_1.xml");
//original code
form.doWithItem("myInp1", "setReadOnly", true);
//added code
form.doWithItem("ID", "setReadOnly", true);
[/code]
xml/detalle_medios_1.xml:
<items>
<item type="label" label="Campos Fijos" />
<item type="input" name="ID" bind="ID" label="Registro" />
</items>
It’s draw the form correctly, but did n’t add readonly property to Input “ID”. Why?
Please try to call form.doWithItem() after form init, using loadStruct() form send async request to server.
You need:
form.loadStruct("xml", function(){
form.doWithItem(...);
});
// or
form.attachEvent("onXLE", function(){
form.doWithItem(...);
});
form.loadStruct("xml");
Excelent ANDREI!!! .
After hours trying finally i saw my mistake: The new funtion
dhtmlXForm.prototype.items.input.setReadOnly = function(item, state) {
var inp = item.childNodes[0].childNodes[1].childNodes[0];
if (state == true) inp.setAttribute("readonly", true); else inp.removeAttribute("readonly");
was not on the right place. I puted inside body & it’s works THANKS A LOT.
Now i have the same problem using the type: “select” how can i buld the function to make the select’s type readonly.
Best
It works correctly?
on safari, works fine. but on IE8,could not change a readOnly attribute.
input field is staying with read/write attribute.
any other solution?
Hello,
I prefer a xml to a json.
when you release a product version, two functions expected.
One is readonly input field in xml structure.
The other is text item type(it contains only text with a bind)
Thanks regards.
Hello,
Check attachment for:
→ it doesn’t works.
(v 3.0)
The other is text item type(it contains only text with a bind)
explain please?
dhtmlxform.js.zip (14.4 KB)