RE: CUSTOM and SUBMIT

"Dietrich J Kappe" <[email protected]> Tue, 15 Nov 2005 12:10:36 -0500
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
 

Bugant wrote:
> hmm... you can do it using javascript... but yes, we could 
> think a nicer way to do it. if you're interested in how to do 
> it with js let me kwon.


If javascript is the direction you guys are leaning toward, why not take a
nice LGPL validation framework, such as http://jsval.fantastic-bits.de/, and
build it into mod_survey?

So, for example:
<TEXT name="zipcode"/>
<VALIDATE target="zipcode" type="regexp" value="^\d{5}$"/>
<VALIDATE target="zipcode" type="required" value="1"/>

Which would translate roughly to:

<head>
   <script language="javascript" src="jsval.js"></script>
   <script language="javascript" type="text/javascript">
   <!--
     function initValidation()
     {
          var objForm = document.forms["surveyform"];
          objForm.zipcode.required = 1;
          objForm.zipcode.regexp = /^\d{5}$/; 
     }
   --//>
   </script>
</head>
<body onLoad="initValidation();">
   <form name="surveyform" method="post" action="whatever.survey"
onSubmit="return validateStandard(this);">


Or something like that.

DJK

Skickat av "Dietrich J Kappe" <[email protected]>
till survey-discussion