How do you cancel  (return from) a form where you have set a SPRY text field as 'required'

Posted on 2010-01-06
Last Modified: 2013-12-12
I have set a few fields on a form as being required (via SPRY) but I also have a 'Cancel' button on the page - of course if I hit the button,  control doesn't pass back to the php as the javascript intervenes first and issues error messages to each empty on screen field - how do you get around this?
Question by:me_patrick
    LVL 70

    Accepted Solution

    Hi me_patrick,

    Does the "Cancel" button cause a form submission?  If so, then Spry (or most any validation) will fire because it works onSubmit by default.

    You would need to use a reset button to return the form to its default state or not use a button at all (use a link instead).

    Author Closing Comment

    Of Course! Yes - use a link - thanks Jason.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    The viewer will learn how to count occurrences of each item in an array.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now