Limiting the size of xforms:textarea

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Limiting the size of xforms:textarea

npujol
Hi,

 Is it ok to limit the size of a text area like this? (since xxforms:size does not work on textareas)?

      <script language="javascript" type="text/javascript">
      	var textarea1 = document.getElementById("PREFERED_CALL_TIME");
     	textarea1.onkeydown=function () {
	     	var val =  ORBEON.xforms.Document.getValue("PREFERED_CALL_TIME");
	        if(val.length &gt;= 10)
	        	ORBEON.xforms.Document.setValue("PREFERED_CALL_TIME", val.substring(0,9));
		};
      </script>
Is there a better way? Are there any unexpected by-products of this approach?

Thanks

Nicolas