Movatterモバイル変換


[0]ホーム

URL:


ProdigyView, profile picture
Uploaded byProdigyView
PPTX, PDF636 views

Custom Validation PHP

This document discusses how to create custom validation rules in ProdigyView. There are three main ways to add custom validation: 1) Using the check() method to check values against built-in rules, 2) Creating functions to define custom validation logic, and 3) Using regular expressions with preg_match. The document provides code examples for each approach and recommends exploring the ProdigyView API documentation and tutorials for more information on validation.

Embed presentation

Downloaded 19 times
Custom Validation
OverviewObjectiveLearn how to create custom validation in ProdigyView.Requirements Understanding of validation Understanding of anonymous functionsEstimated Time8 Minutes                     www.prodigyview.com
Follow Along With Code Example1. Download a copy of the example code at  www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/util/Validation_Custom.php
What is custom validation?Building off of the tutorial on validation basics, we learnedabout the built in validation rules in ProdigyView. But thereis a plethora of things to validate that the PVValidatordoes not have, such as credit card validation. How do weovercome this problem?                    The Answer          Add our own validation
Checking and AddingThe two methods to understand when writing customvalidation are addRule() and check().addRule()Adds a rule to the validator. The rule has a name andparameters that define a rule. The rules can be writtenusing preg_match or anonymous functions.Check()Checks passed values against and should return true orfalse.
Check ExampleOur first example will be using the method check(). Wewill use one of the built checks, integer, which checks if anumber is an int.  The rule to use when checking                  The value to check          Returns false because not an integer
Create Function Here is a method in php you might not see very often, create_function. This function is similar to anonymous functions in that it can create a function on the fly. We are also adding our first custom rule here.1. Create the function            2. Set the type to function and set the function3. Set the name of       4. Add the rule options           5. Execute rule and valuesthe rule
Preg_match     Preg_match is a easy way of validating data based on     formats. If you are new to preg_match, I suggest you     brush up on your regular expressions.    1. Set the type to preg_match             2. Set the regular expression to check                                              against3. Set the name of the rule    4. Add the rules                                                          5. Check value against rule                               options
Anonymous Functions    Our last check can be accomplished using the    anonymous function/closure.1. Create the closure       2. Set the type to ‘closure’     3. Set the closure3. Set the name of the   4. Add the rule options           5. Check values againstrule                                                       rule
Challenge!Perform this optional challenge to better your understanding ofvalidation in ProdigyVIew.1. Create a class with a static method.2. Have that static method accept a check string and check if   that string contains the letters ‘pv_’3. Create an anonymous function that takes the value passed   to it and checks it against the static method and returns the   result.4. Add the anonymous function to the validator, and assign it   name.5. Pass in string values to test.
API ReferenceFor a better understanding of Validation in ProdigyView, visitthe api by clicking on the link below.PVValidator                   More Tutorials  For more tutorials, please visit:  http://www.prodigyview.com/tutorials                         www.prodigyview.com

Recommended

PDF
All About Test Class in #Salesforce
PDF
Test setup methods in Salesforce Apex Class
PDF
Programming katas for Software Testers - CounterStrings
PPT
Quality Software With Unit Test
PPTX
RIA 05 - Unit Testing by Ajinkya Prabhune
PDF
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
PPTX
Unit testing - the hard parts
PPTX
Unit Tests And Automated Testing
PPTX
Fundamentals of unit testing
PPT
Automating C# Coding Standards using StyleCop and FxCop
PDF
vREST Test Automation
PPTX
Refactoring legacy code driven by tests - ENG
PPTX
Vs c# lecture6
PDF
TDD - survival guide
PPTX
Unit Testing Concepts and Best Practices
PDF
Working Effectively with Legacy Code: Lessons in Practice
PDF
Unit testing legacy code
PPTX
Agile korea 2013 유석문
PPTX
Unit Testing
PPTX
Unit Testing And Mocking
PDF
Unit Testing Fundamentals
PPTX
Mock driven development using .NET
PDF
How to prevent duplicate values in a range nta
PPTX
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
PPT
Mutation testing
 
PPTX
Unit testing and test driven development using vs
PPT
6) debugging and testing
PPTX
Understanding Unit Testing
KEY
Workshop quality assurance for php projects tek12
PDF
Quality Assurance for PHP projects - ZendCon 2012

More Related Content

PDF
All About Test Class in #Salesforce
PDF
Test setup methods in Salesforce Apex Class
PDF
Programming katas for Software Testers - CounterStrings
PPT
Quality Software With Unit Test
PPTX
RIA 05 - Unit Testing by Ajinkya Prabhune
PDF
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
PPTX
Unit testing - the hard parts
PPTX
Unit Tests And Automated Testing
All About Test Class in #Salesforce
Test setup methods in Salesforce Apex Class
Programming katas for Software Testers - CounterStrings
Quality Software With Unit Test
RIA 05 - Unit Testing by Ajinkya Prabhune
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Unit testing - the hard parts
Unit Tests And Automated Testing

What's hot

PPTX
Fundamentals of unit testing
PPT
Automating C# Coding Standards using StyleCop and FxCop
PDF
vREST Test Automation
PPTX
Refactoring legacy code driven by tests - ENG
PPTX
Vs c# lecture6
PDF
TDD - survival guide
PPTX
Unit Testing Concepts and Best Practices
PDF
Working Effectively with Legacy Code: Lessons in Practice
PDF
Unit testing legacy code
PPTX
Agile korea 2013 유석문
PPTX
Unit Testing
PPTX
Unit Testing And Mocking
PDF
Unit Testing Fundamentals
PPTX
Mock driven development using .NET
PDF
How to prevent duplicate values in a range nta
PPTX
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
PPT
Mutation testing
 
PPTX
Unit testing and test driven development using vs
PPT
6) debugging and testing
PPTX
Understanding Unit Testing
Fundamentals of unit testing
Automating C# Coding Standards using StyleCop and FxCop
vREST Test Automation
Refactoring legacy code driven by tests - ENG
Vs c# lecture6
TDD - survival guide
Unit Testing Concepts and Best Practices
Working Effectively with Legacy Code: Lessons in Practice
Unit testing legacy code
Agile korea 2013 유석문
Unit Testing
Unit Testing And Mocking
Unit Testing Fundamentals
Mock driven development using .NET
How to prevent duplicate values in a range nta
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Mutation testing
 
Unit testing and test driven development using vs
6) debugging and testing
Understanding Unit Testing

Similar to Custom Validation PHP

KEY
Workshop quality assurance for php projects tek12
PDF
Quality Assurance for PHP projects - ZendCon 2012
PDF
Task 2
 
PPTX
Arrays & functions in php
PDF
Don't Trust Your Users
PDF
Symfony2 validation
KEY
Unit testing with zend framework PHPBenelux
PPT
Form validation server side
PDF
Effective PHP. Part 5
PDF
Unit testing with zend framework tek11
PDF
How to write code you won't hate tomorrow
ODP
Clean code
PPTX
02. input validation module v5
PDF
QA for PHP projects
PPTX
Programming best practices (PHP)
KEY
Unit testing zend framework apps
PDF
Workshop quality assurance for php projects - phpdublin
PDF
Preparing for the next PHP version (5.6)
PDF
lab4_php
PDF
lab4_php
Workshop quality assurance for php projects tek12
Quality Assurance for PHP projects - ZendCon 2012
Task 2
 
Arrays & functions in php
Don't Trust Your Users
Symfony2 validation
Unit testing with zend framework PHPBenelux
Form validation server side
Effective PHP. Part 5
Unit testing with zend framework tek11
How to write code you won't hate tomorrow
Clean code
02. input validation module v5
QA for PHP projects
Programming best practices (PHP)
Unit testing zend framework apps
Workshop quality assurance for php projects - phpdublin
Preparing for the next PHP version (5.6)
lab4_php
lab4_php

More from ProdigyView

PPTX
Installing Plug-ins
PPTX
Building An Application
PPTX
Installing Applications
PPTX
Video Content Management
PPTX
Audio Content Management
PPTX
File Content Management
PPTX
Email Configuration
PPTX
HTML5 Tags and Elements Tutorial
PPTX
HTML Forms Tutorial
PPTX
Html Tags Tutorial
PPTX
Video Conversion PHP
PPTX
Sending Email Basics PHP
PPTX
Tools ProdigyView
PPTX
Basic File Cache Tutorial - PHP
PPTX
Understanding Web Cache
PPTX
Javascript And CSS Libraries
PPTX
PHP Libraries
PPTX
SQL Prepared Statements Tutorial
PPTX
Database Basics
PPTX
Implementing the Adapter Design Pattern
Installing Plug-ins
Building An Application
Installing Applications
Video Content Management
Audio Content Management
File Content Management
Email Configuration
HTML5 Tags and Elements Tutorial
HTML Forms Tutorial
Html Tags Tutorial
Video Conversion PHP
Sending Email Basics PHP
Tools ProdigyView
Basic File Cache Tutorial - PHP
Understanding Web Cache
Javascript And CSS Libraries
PHP Libraries
SQL Prepared Statements Tutorial
Database Basics
Implementing the Adapter Design Pattern

Recently uploaded

PDF
"DISC as GPS for team leaders: how to lead a team from storming to performing...
 
PDF
[BDD 2025 - Artificial Intelligence] AI for the Underdogs: Innovation for Sma...
PDF
Mastering UiPath Maestro – Session 2 – Building a Live Use Case - Session 2
PDF
Open Source Post-Quantum Cryptography - Matt Caswell
PDF
The Necessity of Digital Forensics, the Digital Forensics Process & Laborator...
PDF
Crane Accident Prevention Guide: Key OSHA Regulations for Safer Operations
PDF
[BDD 2025 - Mobile Development] Crafting Immersive UI with E2E and AGSL Shade...
PPTX
Leon Brands - Intro to GPU Occlusion (Graphics Programming Conference 2024)
PDF
Cybersecurity Prevention and Detection: Unit 2
PDF
How Much Does It Cost to Build an eCommerce Website in 2025.pdf
PDF
Transforming Content Operations in the Age of AI
PPTX
Connecting the unconnectable: Exploring LoRaWAN for IoT
PDF
Cheryl Hung, Vibe Coding Auth Without Melting Down! isaqb Software Architectu...
PDF
[DevFest Strasbourg 2025] - NodeJs Can do that !!
PDF
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
PDF
So You Want to Work at Google | DevFest Seattle 2025
PDF
[BDD 2025 - Full-Stack Development] Digital Accessibility: Why Developers nee...
PDF
Accessibility & Inclusion: What Comes Next. Presentation of the Digital Acces...
PDF
Transforming Supply Chains with Amazon Bedrock AgentCore (AWS Swiss User Grou...
PDF
Mastering Agentic Orchestration with UiPath Maestro | Hands on Workshop
"DISC as GPS for team leaders: how to lead a team from storming to performing...
 
[BDD 2025 - Artificial Intelligence] AI for the Underdogs: Innovation for Sma...
Mastering UiPath Maestro – Session 2 – Building a Live Use Case - Session 2
Open Source Post-Quantum Cryptography - Matt Caswell
The Necessity of Digital Forensics, the Digital Forensics Process & Laborator...
Crane Accident Prevention Guide: Key OSHA Regulations for Safer Operations
[BDD 2025 - Mobile Development] Crafting Immersive UI with E2E and AGSL Shade...
Leon Brands - Intro to GPU Occlusion (Graphics Programming Conference 2024)
Cybersecurity Prevention and Detection: Unit 2
How Much Does It Cost to Build an eCommerce Website in 2025.pdf
Transforming Content Operations in the Age of AI
Connecting the unconnectable: Exploring LoRaWAN for IoT
Cheryl Hung, Vibe Coding Auth Without Melting Down! isaqb Software Architectu...
[DevFest Strasbourg 2025] - NodeJs Can do that !!
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
So You Want to Work at Google | DevFest Seattle 2025
[BDD 2025 - Full-Stack Development] Digital Accessibility: Why Developers nee...
Accessibility & Inclusion: What Comes Next. Presentation of the Digital Acces...
Transforming Supply Chains with Amazon Bedrock AgentCore (AWS Swiss User Grou...
Mastering Agentic Orchestration with UiPath Maestro | Hands on Workshop

Custom Validation PHP

  • 1.
  • 2.
    OverviewObjectiveLearn how tocreate custom validation in ProdigyView.Requirements Understanding of validation Understanding of anonymous functionsEstimated Time8 Minutes www.prodigyview.com
  • 3.
    Follow Along WithCode Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/util/Validation_Custom.php
  • 4.
    What is customvalidation?Building off of the tutorial on validation basics, we learnedabout the built in validation rules in ProdigyView. But thereis a plethora of things to validate that the PVValidatordoes not have, such as credit card validation. How do weovercome this problem? The Answer Add our own validation
  • 5.
    Checking and AddingThetwo methods to understand when writing customvalidation are addRule() and check().addRule()Adds a rule to the validator. The rule has a name andparameters that define a rule. The rules can be writtenusing preg_match or anonymous functions.Check()Checks passed values against and should return true orfalse.
  • 6.
    Check ExampleOur firstexample will be using the method check(). Wewill use one of the built checks, integer, which checks if anumber is an int. The rule to use when checking The value to check Returns false because not an integer
  • 7.
    Create Function Hereis a method in php you might not see very often, create_function. This function is similar to anonymous functions in that it can create a function on the fly. We are also adding our first custom rule here.1. Create the function 2. Set the type to function and set the function3. Set the name of 4. Add the rule options 5. Execute rule and valuesthe rule
  • 8.
    Preg_match Preg_match is a easy way of validating data based on formats. If you are new to preg_match, I suggest you brush up on your regular expressions. 1. Set the type to preg_match 2. Set the regular expression to check against3. Set the name of the rule 4. Add the rules 5. Check value against rule options
  • 9.
    Anonymous Functions Our last check can be accomplished using the anonymous function/closure.1. Create the closure 2. Set the type to ‘closure’ 3. Set the closure3. Set the name of the 4. Add the rule options 5. Check values againstrule rule
  • 10.
    Challenge!Perform this optionalchallenge to better your understanding ofvalidation in ProdigyVIew.1. Create a class with a static method.2. Have that static method accept a check string and check if that string contains the letters ‘pv_’3. Create an anonymous function that takes the value passed to it and checks it against the static method and returns the result.4. Add the anonymous function to the validator, and assign it name.5. Pass in string values to test.
  • 11.
    API ReferenceFor abetter understanding of Validation in ProdigyView, visitthe api by clicking on the link below.PVValidator More Tutorials For more tutorials, please visit: http://www.prodigyview.com/tutorials www.prodigyview.com

[8]ページ先頭

©2009-2025 Movatter.jp