SunQuest
 
       Code Examples
  Home arrow Code Examples arrow WAP validation or Wapalidation by Michael ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

WAP validation or Wapalidation by Michael Wright
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2000-11-07

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Validate your WAP pages with Wapalidate

    Many of the unsupported characters within WAP pages are created using website contributors whereby users (webmasters etc) add content via WEB forms which transform custom MS Word characters into HTML code characters e.g. &#8216. These HTML code characters are then stored in databases which when displayed on WAP pages can create compilation errors.

    Wapalidate is a function that can be used to validate strings or database fields so that they compile correctly. This will hopefully help WAP developers to lower the chances of compilation errors and using the same databases for both WEB and WAP sites.

    Here is the code:

    Function Wapalidate(strToCheck)

    ' Replace unsupported characters e.g. HTML code characters

    strToCheck = Replace(strToCheck,"‘","'")

    strToCheck = Replace(strToCheck,"’","'")

    strToCheck = Replace(strToCheck,"“","'")

    strToCheck = Replace(strToCheck,"”","'")

    strToCheck = Replace(strToCheck,"–","-")

    strToCheck = Replace(strToCheck," ","&")

    strToCheck = Replace(strToCheck,"&"," ")

    ' Use the above line to add extra unsupported characters

    ' Replace(strToCheck,"CHANGE THIS","AND WHAT IT WILL BECOME")

    Wapalidate = strToCheck

    End Function

     

    To use the function:

    Wapalidate(VARIABLE NAME) e.g. Wapalidate(Article)

    Wapalidate(FIELD NAME) e.g. Wapalidate(rs("Article"))

    Another way to avoid compilation errors is to make sure that if you are retrieving a large amount of data from a database, that it will not make the output WAP page more than 1440 bytes.

    Here is a snippet of my code:

    LOS = Len(Article)

    ' Display Headline

    %>

    <p align="left"><small><b><%=Headline%></b></small></p>

    <%

    ‘ Display Article

    ' If there are more than 500 characters in string

    nospace = 0

    If LOS > 500 Then ‘ change 500 to anything you like but think about the 1440 bytes per page

    chars = 500 ‘ change 500 to the same as above

    Do while nospace = 0

    ' Retrieve characters from article

    tempArticle = Left(Article,chars)

    If Right(tempArticle,1) = " " then

    nospace = 1

    ' Set tempArticle to Article

    Article = tempArticle

    Else

    nospace = 0

    chars = chars + 1

    End If

    Loop

    ' Calculate amount of characters left

    More = LOS - chars

    ' Display 500 characters within article

    response.write("<p align='left'><small>"&Article&"...</small></p>")

    ' Link to view more of the article

    %>

    <do type="accept" label="More"><go href="NEXT WAP PAGE TO DISPLAY MORE" method="post"><postfield name="id" value="<%=id%>"/><postfield name="more" value="<%=More%>"/></go></do>

    <%

    Else

    ' Display full article

    response.write(Article)

    End If

    To display the remainder on the NEXT WAP PAGE:

    Get the Article strings data again from the database using the id variable and then calculate the remainder by Article = Right(Article,more) then something like

    <p align="left"><small>...<%=Article%></small></p>. Don’t forget to retrieve the id and more variables first.

    Please do not contact me on the above code as I will not reply (I expect you to mess around with the code yourself). If you wish to contact me on updates to the Wapalidate function or job opportunities then please e-mail michael_wright@lineone.net.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Code Examples Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Rational Testing eKits

    Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing.
    FREE! Go There Now!


    NEW! Best practices for software analysis: An introduction to the IBM Rational Software Analyzer application

    This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer.
    FREE! Go There Now!


    Role of Integrated Requirements Management in Software Delivery

    As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change.
    FREE! Go There Now!


    NEW! Calling all CC Power Users – and those that would like to be!

    Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! Webcast: What is new in Viper 2 for developers?

    Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    Be the first to hear about i5/OS V6R1!

    Hold your calendar on January 30, 2008 for this free webcast on the new i5/OS. Rational's Enterprise Modernization products will be discussed at this webcast as they help to drive the application development environment for this new System i OS. <br />And learn how i5/OS will take you to the next step of efficient, resilient business processing. You will hear about the new i5/OS capabilities as it will be the most significant i5/OS release in years. If you cannot join the webcast on 1/30/08 you can still use this link to listen to the replay.<br />
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Tester for SOA Quality V7.0.1

    Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Connectivity

    Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    CODE EXAMPLES ARTICLES

    - Handling Animations and Bitmaps Using GDI+ f...
    - Download a Web Page using the WebClient
    - Creating a Chart using Data from a Database ...
    - The Basics of Charting with the MS Chart Con...
    - Searching Body Text with textRange: Enter th...
    - Searching Body Text with textRange: Building...
    - Searching Body Text with textRange, part 1: ...
    - First Steps in Programming
    - Programming in C
    - Quick Introduction to ASF,ASX, and Networkin...
    - SatView: Pointer Perfect, Part 2: Constructi...
    - SatView: Pointer Perfect, Part 1
    - Style Case Studies: Construction Unions
    - Creating an Engine for Games for Windows
    - Style Case Studies: Generic Callbacks





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway