Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
HTML

<div id="main-content" class="wiki-content group">
	<p>The process form validation in ECM is performed through the
		customization of card index and process events using scripts in the
		JavaScript language. Events can be implemented in ECM itself or sent
		by Protheus as parameter of the functions used in the previous
		examples.</p>
	<p>
		To validate the fields provided by the user, use the process <strong>beforeTaskSave</strong>
		event that runs on the confirmation of each task to be sent to the
		next step in the workflow.
	</p>
	<p>
		To access the value of a form field, use the <strong>hAPI.</strong><strong>
		</strong><strong>getCardValue</strong>(&lt;nomeCampo>) workflow API and, to
		handle exceptions, use the <strong>throw</strong> &lt;message>
		command, which will present the message to the user preventing them
		from proceeding until they correct the information typed.
	</p>
	<h1 id="id-2.3Validaçãodoformulário-ScriptdoeventonoECM">Event
		script in ECM</h1>
	<p>Simple validations can be performed in the event script to avoid
		unnecessary communication with Protheus immediately returning a
		message to the user.</p>
	<p>&#160;</p>
	<blockquote>
		<p>function beforeTaskSave(colleagueId,nextSequenceId,userList){</p>
		<p>var A1_COD = hAPI.getCardValue("A1_COD");</p>
		<p>&#160;</p>
		<p>if (A1_COD == ""){</p>
		<p>&#160;&#160; throw "The Code field is mandatory"</p>
		<p>}</p>
		<p>}</p>
	</blockquote>
	<h1 id="id-2.3Validaçãodoformulário-Protheus">Protheus</h1>
	<p>
		Validation in the event scripts using external applications is
		performed via <a
			href="http://tdn.totvs.com/display/tec/Web+Services+com+o+ERP+Microsiga+Protheus">WebServices
		</a> that should be registered as service in ECM in the <em>Control
			Panel > Services > Add</em> option. When any WebService definition is
		changed or added, you will need to update ECM in <em>Control
			Panel > Services > Edit > Refresh</em> option.
	</p>
	<p>
		The WebService can be registered through the ECM Control Panel or
		Protheus using the <strong>FWWFPutService function, as in the
			example below</strong>.
	</p>
	<blockquote>
		<p>#include "totvs.ch"</p>
		<p>&#160;</p>
		<p>User Function WSCliente()</p>
		<p>Local cName := "WSCLIENTE"</p>
		<p>
			Local cURL := "<a href="http://hostname:8080/ws/exemplo.apw?wsdl"
				class="external-link" rel="nofollow">http://hostname:8080/ws/exemplo.apw?wsdl</a>"
		</p>
		<p>Local cDescription := "Service to be validated and updated in
			customer file"</p>
		<p>&#160;</p>
		<p>
			If <strong>FWWFPutService(cName,cUrl,cDescription)</strong>
		</p>
		<p>&#160;&#160; MsgInfo("Service successfully registered")</p>
		<p>EndIf</p>
		<p>Return</p>
	</blockquote>
	<h1 id="id-2.3Validaçãodoformulário-WebService">WebService</h1>
	<p>
		For more information on how to develop Web Services with Microsiga
		Protheus, see the link: <a
			href="http://tdn.totvs.com/display/tec/Web+Services+com+o+ERP+Microsiga+Protheus">Web
			Services with ERP Microsiga Protheus</a>.
	</p>
	<p>Protheus WebService Example:</p>
	<p>&#160;</p>
	<blockquote>
		<p>#include "totvs.ch"</p>
		<p>#include "apwebsrv.ch"</p>
		<p>&#160;</p>
		<p>WSSERVICE WSCLIENTE DESCRIPTION "Customer file example"</p>
		<p>WSDATA A1_COD AS STRING</p>
		<p>WSDATA A1_LOJA AS STRING</p>
		<p>WSDATA XML AS Base64Binary</p>
		<p>WSDATA RETEXISTCOD AS BOOLEAN</p>
		<p>WSDATA RETINCLUIR AS BOOLEAN</p>
		<p>WSMETHOD ExistCod DESCRIPTION "Checks if customer code already
			exists"</p>
		<p>WSMETHOD Incluir DESCRIPTION "Adds customer"</p>
		<p>ENDWSSERVICE</p>
		<p>&#160;</p>
		<p>WSMETHOD ExistCod WSRECEIVE A1_COD,A1_LOJA WSSEND RETEXISTCOD
			WSSERVICE WSCLIENTE&#160;&#160;</p>
		<p>&#160;</p>
		<p>Private INCLUI := .T.</p>
		<p>&#160;</p>
		<p>::RETEXISTCOD := existchav("SA1",::A1_COD+::A1_LOJA)</p>
		<p>Return .T.</p>
		<p>&#160;</p>
		<p>WSMETHOD Incluir WSRECEIVE XML WSSEND RETINCLUIR WSSERVICE
			WSCLIENTE</p>
		<p>Local oXML := tXMLManager():New()</p>
		<p>Local lRet := .T.</p>
		<p>Local aDadosCli := {}</p>
		<p>&#160;</p>
		<p>If oXML:Parse(::XML)</p>
		<p>&#160;&#160; aAdd( aDadosCli, {
			"A1_COD"&#160;&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_COD")&#160;&#160; , NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, { "A1_LOJA"&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_LOJA")&#160; , NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, { "A1_TIPO"&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_TIPO")&#160; , NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, { "A1_PESSOA"&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_PESSOA"), NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, { "A1_NOME"&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_NOME")&#160; , NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, { "A1_NREDUZ"&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_NREDUZ"), NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, {
			"A1_END"&#160;&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_END") &#160;&#160;, NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, {
			"A1_MUN"&#160;&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_MUN")&#160;&#160; , NIL } )</p>
		<p>&#160;&#160; aAdd( aDadosCli, {
			"A1_EST"&#160;&#160;&#160;&#160; ,
			oXML:XPathGetNodeValue("/SA1/A1_EST")&#160;&#160; , NIL } )</p>
		<p>&#160;</p>
		<p>&#160;&#160; lMsErroAuto := .F.</p>
		<p>&#160;&#160; MSExecAuto( { | x, y | MATA030( x, y ) } ,
			aDadosCli, 3 )</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;</p>
		<p>&#160;&#160; If lMsErroAuto</p>
		<p>&#160;&#160;&#160;&#160;&#160; If __lSX8</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RollBackSX8()</p>
		<p>&#160;&#160;&#160;&#160;&#160; EndIf</p>
		<p>&#160;&#160;&#160;&#160;&#160; ::RETINCLUIR :=
			.F.&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</p>
		<p>&#160;&#160; Else</p>
		<p>&#160;&#160;&#160;&#160;&#160; If __lSX8</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ConFirmSX8()</p>
		<p>&#160;&#160;&#160;&#160;&#160; EndIf</p>
		<p>&#160;&#160;&#160;&#160;&#160; ::RETINCLUIR := .T.</p>
		<p>&#160;&#160; EndIf</p>
		<p>Else</p>
		<p>&#160;&#160; SetSoapFault("WSCLIENTE:INCLUIR",oXML:LastError())</p>
		<p>&#160;&#160; lRet := .F.</p>
		<p>EndIf&#160;&#160;&#160;</p>
		<p>Return lRet</p>
		<p>&#160;</p>
	</blockquote>
	<p>
		Validation on the <strong>beforeTaskSave</strong> event script:
	</p>
	<ol>
		<li>Call the service load with the <strong>ServiceManager.getService</strong>
			method
		</li>
		<li>Use the <strong>getBean</strong> method to return the utility
			for access to the service classes through the instantiate method by
			sending as a parameter the <em>Locator</em> class that is described
			in ECM in <em>Control Panel > Services</em>, select the service and
			click <em>View</em></li>
		<li>Call the method to instantiate the service (in this example <strong>getWSCLIENTESOAP</strong>)
			that is also described in the <em>Control Panel > Services >
				View</em> option
		</li>
		<li>Call the service method (in the example <strong>ExistCod</strong>)
		</li>
	</ol>
	<p>&#160;</p>
	<blockquote>
		<p>function beforeTaskSave(colleagueId,nextSequenceId,userList){</p>
		<p>var A1_COD = hAPI.getCardValue("A1_COD");</p>
		<p>&#160;</p>
		<p>if (A1_COD == ""){</p>
		<p>&#160;&#160; throw "The Code field is mandatory"</p>
		<p>}</p>
		<p>&#160;</p>
		<p>
			var wsService = <strong>ServiceManager.getService("WSCLIENTE")</strong>;
		</p>
		<p>
			var serviceHelper = wsService.<strong>getBean()</strong>;
		</p>
		<p>
			var serviceLocator = serviceHelper.<strong>instantiate("localhost.WSCLIENTELocator")</strong>;
		</p>
		<p>
			var service = serviceLocator.<strong>getWSCLIENTESOAP()</strong>;
		</p>
		<p>var ret = false;</p>
		<p>&#160;</p>
		<p>try {</p>
		<p>
			&#160;&#160; ret = service.<strong>EXISTCOD(A1_COD</strong>);
		</p>
		<p>}</p>
		<p>catch(erro){</p>
		<p>&#160;&#160; throw erro.message</p>
		<p>}</p>
		<p>&#160;</p>
		<p>if (!ret) {</p>
		<p>&#160;&#160; throw "Customer already exists";</p>
		<p>}</p>
		<p>}</p>
	</blockquote>
	<h1 id="id-2.3Validaçãodoformulário-MVC">MVC</h1>
	<p>
		The validation process of a MVC routine is performed using the <strong>FWWSMODEL</strong>
		WebService (<a href="http://hostexemplo:8080/ws/fwwsmodel.apw?wsdl"
			class="external-link" rel="nofollow">http://hostexemplo:8080/ws/fwwsmodel.apw?wsdl</a>)
		with the invocation of the <strong>GETXMLDATADETAIL</strong> method
		that returns the XML of the model to populate the data and the <strong>VLDXMLDATA</strong>
		method that will validate the XML.
	</p>
	<p>&#160;</p>
	<blockquote>
		<p>#include "totvs.ch"</p>
		<p>User Function WSMVC()</p>
		<p>Local cName := "TOTVS_FWMVC"</p>
		<p>
			Local cURL := "<a href="http://hostname:8080/ws/fwwsmodel.apw?wsdl"
				class="external-link" rel="nofollow">http://hostname:8080/ws/fwwsmodel.apw?wsdl</a>
			"
		</p>
		<p>Local cDescription := "TOTVS MVC Service for integrating
			routines/programs with ECM"</p>
		<p>Local aService := FWWFGetService(cName)</p>
		<p>&#160;</p>
		<p>
			If Empty(aService) .and. <strong>FWWFPutService(cName,cUrl,cDescription)</strong>
		</p>
		<p>&#160;&#160; MsgInfo("Service successfully registered")</p>
		<p>EndIf</p>
		<p>Return</p>
	</blockquote>
	<p>&#160;</p>
	<p>
		Validation on the <strong>beforeTaskSave</strong> event script:
	</p>
	<p>&#160;</p>
	<blockquote>
		<p>
			function <strong>beforeTaskSave</strong>(colleagueId,nextSequenceId,userList){
		</p>
		<p>var wsService = ServiceManager.getService("TOTVS_FWMVC");</p>
		<p>var serviceHelper = wsService.getBean();</p>
		<p>var serviceLocator =
			serviceHelper.instantiate("br.com.totvs.webservices.fwwsmodel_apw.FWWSMODELLocator");</p>
		<p>var service = serviceLocator.getFWWSMODELSOAP();</p>
		<p>
			var err = {message:"", <a href="http://emptytrue"
				class="external-link" rel="nofollow">empty:true</a>};
		</p>
		<p>var ret, xml;</p>
		<p>&#160;</p>
		<p>try {</p>
		<p>
			&#160;&#160; ret = service.<strong>GETXMLDATADETAIL</strong>([],"MATA030_MVC");
		</p>
		<p>&#160;&#160; xml = new XML(new String(new
			java.lang.String(ret)).replace(/&lt;\?.*\?>/g,""));</p>
		<p>}</p>
		<p>catch(erro){</p>
		<p>&#160;&#160; throw erro.message;</p>
		<p>&#160;&#160; return;</p>
		<p>}</p>
		<p>&#160;</p>
		<p>updateXMLFields(xml,err);</p>
		<p>&#160;</p>
		<p>if (err.message.length > 0){</p>
		<p>&#160;&#160; throw err.message;</p>
		<p>}</p>
		<p>else if (err.empty){</p>
		<p>&#160;&#160; throw "Fill out form";</p>
		<p>}</p>
		<p>else{</p>
		<p>&#160;&#160; eval("xml.@Operation = 3");</p>
		<p>&#160;&#160; try{</p>
		<p>
			&#160;&#160;&#160;&#160;&#160; service.<strong>VLDXMLDATA</strong>([],"MATA030_MVC",new
			java.lang.String(xml.toXMLString()).getBytes());
		</p>
		<p>&#160;&#160; } catch(e){</p>
		<p>&#160;&#160;&#160;&#160;&#160; throw e.message;</p>
		<p>&#160;&#160; }</p>
		<p>}</p>
		<p>}</p>
		<p>&#160;</p>
		<p>function updateXMLFields(node,err){</p>
		<p>var list = node.children();</p>
		<p>var name,value;</p>
		<p>&#160;</p>
		<p>for (var i=0;i&lt;list.length();i++){</p>
		<p>&#160;&#160; switch
			(Trim(eval("list[i][email protected]()"))){</p>
		<p>&#160;&#160;&#160;&#160;&#160; case "FIELDS":</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			updateXMLFields(list[i],err);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>&#160;&#160;&#160;&#160;&#160; default:</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; name =
			list[i].name().localName;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; value =
			hAPI.getCardValue(name);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (value !=
			null)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			list[i].value = convertValue(name,list[i],value,err);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; if (err.message.length > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>}</p>
		<p>}</p>
		<p>&#160;</p>
		<p>function convertValue(name,struct,value,err){</p>
		<p>var y,m,d,n,len,str,reg</p>
		<p>var setYear = new
			Date().getFullYear().toString().substring(0,2);</p>
		<p>var setDate = "dd/mm/yyyy";</p>
		<p>var yCount = setDate.match(/yyyy/) ? 4 : 2;</p>
		<p>var hasErr = false;</p>
		<p>&#160;</p>
		<p>value = value.trim();</p>
		<p>&#160;</p>
		<p>switch (eval("[email protected]()")){</p>
		<p>case "D":</p>
		<p>&#160;&#160; if (value.replace("/","").trim() != ""){</p>
		<p>&#160;&#160;&#160;&#160;&#160; len = value.length();</p>
		<p>&#160;&#160;&#160;&#160;&#160; d = setDate.indexOf("d");</p>
		<p>&#160;&#160;&#160;&#160;&#160; m = setDate.indexOf("m");</p>
		<p>&#160;&#160;&#160;&#160;&#160; y = setDate.indexOf("y");</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (d + 2 > len || m + 2 > len
			|| y + yCount > len){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; else{</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.substr(m,2) + value.substr(d,2);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (yCount ==
			4)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			str = value.substr(y,4) + str;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			str = setYear + value.substr(y,2) + str;</p>
		<p>&#160;</p>
		<p align="left">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if
			(str.match(/((((19|20)(([02468][048])|([13579][26]))0229))|((19|20)[0-9][0-9])((((0[1-9])|(1[0-2]))((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))31)|(((0[1,3-9])|(1[0-2]))(29|30)))))/g))</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (hasErr)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; err.message =
			"The field "+eval("struct.@info")+" ("+name+") has an invalid date";</p>
		<p>&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; err.empty =
			false;</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; break;</p>
		<p>case "N":</p>
		<p>&#160;&#160; len = eval("[email protected]().split(',')");</p>
		<p>&#160;&#160; if (len[1] == "0"){</p>
		<p>&#160;&#160;&#160;&#160;&#160; reg = new
			RegExp("^[0-9]{1,"+len[0]+"}$");</p>
		<p>&#160;&#160;&#160;&#160;&#160; str = value.replace(",","");</p>
		<p>&#160;&#160;&#160;&#160;&#160; if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.replace(".","");</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.message = "The field "+eval("struct.@info")+" ("+name+") has an
			invalid number (value or size)"</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			break;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (!hasErr){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; n =
			parseInt(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if
			(!isNaN(n)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if (n > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.empty = false;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; else{</p>
		<p>&#160;&#160;&#160;&#160;&#160; reg = new
			RegExp("^0$|^0\.[0-9]{1,"+len[1]+"}$|^[0-9]{0,"+len[0]+"}(\.[0-9]{1,"+len[1]+"})?$");</p>
		<p>&#160;&#160;&#160;&#160;&#160; str =
			value.replace(".","").replace(",",".");</p>
		<p>&#160;&#160;&#160;&#160;&#160; if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.replace(",","");</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.message = "The field "+eval("struct.@info")+" ("+name+") has an
			invalid number (value or size)"</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			break;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (!hasErr){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; n =
			parseFloat(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if
			(!isNaN(n)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if (n > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.empty = false;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; break;</p>
		<p>default:</p>
		<p>&#160;&#160; if (value != "")</p>
		<p>&#160;&#160;&#160;&#160;&#160; err.empty = false;</p>
		<p>&#160;&#160; break;</p>
		<p>}</p>
		<p>return value;</p>
		<p>}</p>
		<p>function Trim(str){return str.replace(/^\s+|\s+$/g,"");}</p>
	</blockquote>
</div>