Dhtmlxform inside a dhtmlxwindow myForm.setRequired(id,true)

Hello,

I have a form inside a window and setRequired funtion does not work and reports this error when called:
TypeError: this._s2b is not a function in dhtmlxform_dyn.js (line 11) which is:

[...] dhtmlXForm.prototype.setRequired=function(b,e,c){typeof c=="undefined"?c=e:b=[b,e];var a=this._getItemNode(b);if(a){c=this._s2b(c);a._required=c==!0;if(a._required){if(!a._validate)a._validate=[];for(var d=!1,g=0;g<a._validate.length;g++)d=a._validate[g]=="NotEmpty"||d;d||a._validate.push("NotEmpty");var f=a.childNodes[a._ll?0:1].childNodes[0];if(!f.lastChild||!(f.lastChild.className&&f.lastChild.className.search(/required/)>=0)){var h=document.createElement("SPAN");h.className="dhxform_item_required"; [...]

Here I provide the code part when I try to accomplish this task:

[code]var dhxWins= new dhtmlXWindows();
var window = dhxWins.createWindow(“nuevaAsignatura”, 300, 50, 400, 230);
window.setText(‘<bean:message key=“title.crear.nueva.asignatura” />’);
window.setModal(true);
window.centerOnScreen();
formNuevaAsignatura = window.attachForm();
formNuevaAsignatura.loadStruct(‘…/xml/forms/new_asignatura_common_form.xml’, function() {
formNuevaAsignatura.setItemLabel(‘data’,‘<bean:message key=“title.info.general.asignatura”/>’);
formNuevaAsignatura.setItemLabel(‘numeroRubricas’,‘<bean:message key=“label.numero.rubricas”/>’);
formNuevaAsignatura.setItemLabel(‘codigo’,‘<bean:message key=“label.codigo.asignatura”/>’);
formNuevaAsignatura.setItemLabel(‘curso’,‘<bean:message key=“label.curso.asignatura”/>’);

formNuevaAsignatura.forEachItem(function(id){
formNuevaAsignatura.setRequired(id,true);});[/code]

If you could help me I would really appreciate it.

Hi

please provide completed demo

Hi,

and sorry for the late response. What do you mean by complete demo? I can send you the jsp and the xml template of the form which is used in the jsp. Is that fine??

Thank you very much.

Hi, pecas
Provide you the link with guide of creation completed demo:
docs.dhtmlx.com/doku.php?id=othe … leted_demo

Hi,

here’s the demo, hope is correctly constructed. thank you very much
Complete Demo.7z (419 KB)

viewtopic.php?f=17&t=36738

Thanks! This solved the issue!