RE: CUSTOM and SUBMIT

Joel Palmius <[email protected]> Fri, 18 Nov 2005 12:52:42 +0100 (CET)
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
Well, there are always lots of fields that needs validation: zip, phone, 
mail, SIN, icq, age... I prefer making it possible for people to add 
their own validation. This generic validation is not perfect though.

Possibly, a TEXT field could have another parameter "VALIDATION" which 
accepts a regexp as input. That could make it a lot easier to do your own 
custom validations of text input fields.

   // Joel


On Tue, 15 Nov 2005, Dietrich J Kappe wrote:

>
>
> 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
>
Skickat av Joel Palmius <[email protected]>
till survey-discussion