<?xml version="1.0" encoding="UTF-8"?>
<dynaForm sql="SELECT * FROM GROUPWF" type="xmlform" sqlConnection="" deleteRow="0" menu="groups/groups_Options" filterForm="groups/groups_Search" width="95%" enableTemplate="1">
  <title type="title" colWidth="200" showInTable="0">
    <en><![CDATA[Group Information]]></en>
  </title>
  <GRP_UID type="hidden" showInTable="0">
</GRP_UID>
  <GRP_TITLE type="text" colWidth="200" size="30" maxlength="64" required="1">
    <en><![CDATA[Name]]></en>
  </GRP_TITLE>
  <GRP_STATUS type="dropdown" colWidth="150" align="center">
    <en><![CDATA[Status]]><option name="ACTIVE"><![CDATA[Active]]></option><option name="INACTIVE"><![CDATA[Inactive]]></option></en>
  </GRP_STATUS>
  <BTN_CANCEL type="button" onclick="cancel();">
    <en><![CDATA[Cancel]]></en>
  </BTN_CANCEL>
  <button type="button" onclick="validateLocalFields(this.form);" showInTable="0">
    <en><![CDATA[Save]]></en>
  </button>
  <JS type="javascript" replacetags="1"><![CDATA[
var sGroupname;
sGroupname = document.forms[0].elements['form[GRP_TITLE]'].value;

var verifyGroupname = function()
{ 
  document.forms[0].elements['form[GRP_TITLE]'].disabled = true;
  document.forms[0].elements['form[button]'].disabled = true;    
  
  var newvar =(typeof(this.value)=="undefined" )?getField('GRP_TITLE').value:this.value;
  
  var oRPC = new leimnud.module.rpc.xmlhttp({
    url    :'groups_Ajax',
    async  : false,
    method :'POST',
    args   :'action=verifyGroupname&sOriginalGroupname=' + sGroupname + '&sGroupname=' + encodeURIComponent(newvar)});
  oRPC.make();
  var sResponse = oRPC.xmlhttp.responseText; 
  document.forms[0].elements['form[GRP_TITLE]'].disabled = false;
  if (sResponse == 1)
  {
    new leimnud.module.app.alert().make({
     label: G_STRINGS.ID_MSJ
   });
    document.forms[0].elements['form[GRP_TITLE]'].focus();
  }
  else
  {
    document.forms[0].elements['form[button]'].disabled = false;
  }
};
  
leimnud.event.add(document.forms[0].elements['form[GRP_TITLE]'],'change',verifyGroupname);  
var validateLocalFields = function(oForm)
{ oAux1 = oForm.elements['form[GRP_TITLE]'];
 if (oAux1.value == '')
 {
  new leimnud.module.app.alert().make({
     label:G_STRINGS.DBCONNECTIONS_ALERT
   });
  oAux1.focus();
  bContinue = false;
  return false;
 }
     else{
  saveGroup(oForm);
     }

}
function cancel() {
    currentPopupWindow.remove();
}

document.onkeypress=function(e){
var esIE =(document.all);
var esNS =(document.layers);
valueKey = (esIE) ? event.keyCode : e.which;
if(valueKey == 13){
   bContinue = false;
   return false;
  }
}

]]></JS>
</dynaForm>
