Home Development Tools dreamweaver Custom verification code for SPRY in DreamWeaver CS3

Custom verification code for SPRY in DreamWeaver CS3

Sep 29, 2018 pm 04:01 PM

The content of this article is about the custom verification code of SPRY in DreamWeaver CS3. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

In the past two days, I have used the SPRY component in DreamWeaver CS3. Found that it can automatically perform front-end authentication on some inputs. It is quite convenient. It has some built-in verification content, such as: number verification, string verification, postal code verification, date verification, etc.

However, the fly in the ointment is that some of its built-in verifications are not very practical in China, because some of the verifications it provides are based on American standards, which are somewhat different from Chinese standards. gap.

At this time, the only thing that comes to mind is to extend its verification. I don’t want to modify its code because I’m not good enough. See if there are other ways. After looking for some information on the Internet and through my own practice, I finally succeeded. Now assign the code after it.

<span id="sprytextfield1">
<input type="text" name="text1" id="text1"  />
<span class="textfieldRequiredMsg">需要提供一个值。</span>
 <span class="textfieldInvalidFormatMsg">数据无效。</span></span>
Copy after login

This is a piece of code generated by manually dragging a SPRY text box for verification.

The following is a code that declares SPRY

<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField
("sprytextfield1", "custom", {validateOn:["blur"],validation:EXT});
//-->
</script>
Copy after login

The last validation: EXT was added manually by me, indicating that the verification of SPRY is achieved by calling the EXT function. EXT returns True, indicating that the verification passes, EXT returns False, indicating that the verification fails. (EXT is the function name, you can define it by yourself, but this method does not seem to be able to pass parameters)

<script language="javascript">
var EXT = function(){
var objReg=/(13)(\d{9})/;
        t=form1.text1.value;
return objReg.test(t);
    }
</script>
Copy after login

The above code means that when verifying the content of text1, it matches the Chinese mobile phone number.

We can achieve custom verification effects by modifying the EXT function. For example: verify whether the contents in the password box and the repeat password box are the same.

<script language="javascript">
var EXT = function(){
return (form1.Pass.value==form1.RePass.value);
    }
</script>
Copy after login

The above is the detailed content of Custom verification code for SPRY in DreamWeaver CS3. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24