About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« How to Use a LotusScript Print Statement to Open Another Web Page in a WebQuerySave Agent | Main| A little catch-up on IBM news and notes... »

How to Code the "Submit" Button when Using JavaScript Form Validation

Category Software Development

One more "reference piece" for me...  From the KnowledgeBase...

How to Code the "Submit" Button when Using JavaScript Form Validation

Doc Number:  1087237

Problem
Using Domino Designer 5.x, you want to use JavaScript to validate a form's input values before allowing a document to be submitted and you would like to design this form so that it works the same way in a Notes client as it does from a web browser.  But when you select a Button that saves and closes the window from a Notes client you find that the document is closed regardless of whether input validation failed or not.

Content
Using Domino Designer 5.x, the Submit button on the form can be coded as follows:

@If(@Command([FileSave]); @Command([FileCloseWindow]); "" )

The JS Header property of the form has the following code:

function validate() {
        if (document.forms[0].Test.value == "") {
                alert("Must enter value for Test");
                return false;
        }
}

The onSubmit event of the form should be coded as follows:

return validate()

When the form's Submit button is selected, the browser displays a JavaScript Alert and the document will NOT be submitted to the server.

To provide this functionality on a Domino 4.6.x server, see document number  172406, "Global Input Validation with JavaScript in a Web Browser."

Comments

Gravatar Image1 -

Gravatar Image2 - I have gotten into the habit of using @If(@FileSave;..) even when I am doing Lotusscript validation. I am still easing into using JavaScript validation in the client because I just do not trust it yet.

I have, however, successfully used a JavaScript regular expression in a field validation that I got from some blog or web site, I just cannot rememeber where at the moment. So maybe I should move ahead with the times...

Gravatar Image3 - yityityityi

Gravatar Image4 - tester To see whether this button sumits and saves ina database

Gravatar Image5 - Applian Technologies: Specializing commerce search site in Coupons, Rebates, Sales, and Free shipping, has helped more than one million shoppers save money. Find all of the Best coupons, Coupon codes, Online Discount Coupons, Promotion Codes and Online Deals. Coupon codes and Online Promotional Coupons and Codes, Professional discount stores reviews and consumer information an Discounts. More information: { " rel="nofollow" target ="blank">Link }

Gravatar Image6 - Save money and time with <a href="{ Link } Govmint </a> Online Discount Coupons, Coupon Codes, Promotions, online discount Code, promotional codes, Promo Code, Rebates, Govmint Clearance sale, Vouchers, Special Discounts, Discount Coupon Codes, Deals, Online Promo Codes and Free Shopping discount Deals. Get great Discount offers, Govmint.com free shipping promo codes for shoppers, Coupons, Bargains, Voucher Codes and Promo Coupons

Gravatar Image7 - I cannot agree more. I can not always find worthy resources with interesting articles to read.

Gravatar Image8 - cxv

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...