Is there any way to add
<a href="somepage.php" onclick="someFunction()"><img src="Test.gif"></a>
in the XML that is used to initialize a form?
Thank you
Is there any way to add
<a href="somepage.php" onclick="someFunction()"><img src="Test.gif"></a>
in the XML that is used to initialize a form?
Thank you
Hi.
And what do you plan to have as a result?
Hi ,
I know the code is wrong but I saw it when it was too late and I couldn’t edit the entry, I should have written 2 lines in order to explain.
<a href="javascript:open_grid_selector('countries_grid','field_country_id','field_country_description');">Select Country</a>
The idea behind all this is to give the user the option to open a new window which will display a grid with possible values and ability to filter data (which a selector can’t do). The user will doubleclick one row and the ID/code of the row clicked will be entered in the form along with the description (in this case the country name which is not stored in the DB).
I have done it in HTML initialized form like this:
If user clicks on the “…” button then the grid shows up.
So , the user clicks the button and the grid window appears. User double clicks the entry he wants and then it’s automatically entered in the form.
Since there is a problem with HTML initialized forms (see : viewtopic.php?f=17&t=15977) I thought it’s best to avoid use of HTML form if possible and try to implement this functionality using XML form.
Hello,
add something like:
dhtmlXForm.prototype.items.input.setClickHandler = function(item){
var inp = item.childNodes[0].childNodes[1].childNodes[0];
inp.onclick = function(){
showMyWindow(this._idd);
}
// you also can set item readonly here
inp.setAttribute("readonly", true);
};
function showMyWindow(itemId) {
// show your window here
// itemId param will "myInput" for this example
};
var formData = [{type: "input", name: "myInput", ...}...];
// i.e. this extension is for input
myForm = new dhtmlXForm("formContainer", formData);
// and after form will inited, call
myForm.doWithItem("myInput", "setClickHandler");
WoW , pretty advanced for me , THANKS will try that.
If I understand the code correctly, then when user clicks on an “INPUT” item it will fire the event and show my window.
So I can put in xml something like this:
<item type="image" src="spyglass.gif" .....>
And user can click on image to show the ListOfVallues window.
Sounds awesome (if I understood properly)
Yes, something like, but type=“image” bot supported by this version of form.
It is supported.
Check dhtmlxform.js lines : 1113-1115
case 'image':
value = elem['object'].src;
break;
This is NOT my custom code, it’s right there in dhtmlxform.js which is included in the download file “dhtmlxsuite.zip”
this depending on form init.