One possible solution for inputs type radio

Hi, First all sorry my expressions, English is not my language.

I had working with dhtmlxform and I realize that I couldn’t create a new form and send the inputs radios whit the function “send(…)”.

I hope that this solution can help for a possible next version of dhtmlxform

I modify the javascript file and I think this may help some other as possible solution. Whit this solution we can send radios single…

<input type="radio" name="myradio" value="1"></input> <input type="radio" name="myradio" value="2"></input>
…and radios arrays…

<input type="radio" name="myradio[0]" value="1"></input> <input type="radio" name="myradio[0]" value="2"></input> <input type="radio" name="myradio[1]" value="1"></input> <input type="radio" name="myradio[1]" value="2"></input>
…radio arrays maybe useful for generate forms through php

I push the code if someone is interested, I repeat, this only add functionality of captura radio buttons when we make “var form = new dhtmlxform(…)”. In addition I modify because it dont return the loader after send and it block my form after send:

[code]line 941-942: dhtmlform.js
if (name)
query.push(pref+name+“=”+encodeURIComponent(this._getElementValue({object:els[i]})));

replace:
if (name) {
if(els[i].type==“radio”){
if(els[i].checked){
query.push(pref+name+“=”+els[i].value);
}
}else{
query.push(pref+name+“=”+encodeURIComponent(this._getElementValue({object:els[i]})));
}
}

line 1000-1003: dhtmlform.js
if (mode==“post”)
dhtmlxAjax.post(url,query,cback);
else
dhtmlxAjax.get(url+((url.indexOf(“?”)==-1)?“?”:“&”)+query,cback);

replace:
if (mode == “post”) {
return dhtmlxAjax.post(url, query, cback);
}else if(mode == “get”){
return dhtmlxAjax.get(url + ((url.indexOf(“?”) == -1) ? “?” : “&”) + query, cback);
}else if(mode == “postSync”){
return dhtmlxAjax.postSync(url, query, cback);
}else if(mode == “getSync”){
return dhtmlxAjax.getSync(url + ((url.indexOf(“?”) == -1) ? “?” : “&”) + query, cback);
}else{
alert(‘You must specify mode of submit form (post/get/postSync/getSync)’);
}

line 985: dhtmlform.js
this.block.style.display = ‘block’;

replace:
//this.block.style.display = ‘block’;[/code]

Regars…

Thanks for provided code, we will look how it can be integrated in the main codebase