Adding global validation before submit (javascript)

Context: need for validation or special javascript behaviour before POST.

Since the asp.net postback mecanism occurs with html POST method, it is possible to add an javascript event that replace the normal post event to force a special behaviour or validation.

This function define a pointer to the normal post event of the form, than it define a behaviour that will occur when the post event will fire. This behaviour decides if the form will really submit (ie firing a asp.net postback event).


// setting the handler of the main form:
SetSubmitHandler(document.forms[0]);

// handler definition to personalize
function SetSubmitHandler(form)
{
// setting a pointer to the original submit function
// to really post the form to the server
form.orginalSubmit = form.submit;

// function that replaces the normal post function
form.newSubmit = function()
{
// special behaviour
// .....
if (1==1)// validation goes here..
{
// validation is ok --> post to the server
form.orginalSubmit();
}
}
// replacing the standard handler (posting to the server)
// with the new handler
form.submit = form.newSubmit;
}

26 comments:

Anonymous said...

Order Generic Tamiflu Online. Order Generic Medication In own Pharmacy. Buy Pills Central.
[url=http://buypillscentral.com/news_en-us.htm]Discount Viagra, Cialis, Levitra, Tamiflu Drugstore Online[/url]. rx generic pills. Top quality drugs pharmacy

Anonymous said...

школьницы голые онлайн http://free-3x.com/ порно видео выпускниц 2008 free-3x.com/ гинеколог в школе фото видео [url=http://free-3x.com/]free-3x.com[/url]

Anonymous said...

When you position Viagra or some other meds in our machine shop you may be established Best Discount Viagra Pharmacy Online that this issue simply of best quality desire be delivered to you systematically in time.

Anonymous said...

We are glad that our attendance Procure Viagra Rebate Apothecary is joined of the best in the Internet, commonly, Cheap Discount Cialis Pharmacy On-line specializing on online pharmaceutics Cialis.

Anonymous said...

Suitable innumerable years Obtain Cialis Discount Pharmaceutics has been recognizable surrounded by outstanding online drugstore suppliers and customers all over order Viagra now the world.

Anonymous said...

...please where can I buy a unicorn?

Anonymous said...

...please where can I buy a unicorn?

Anonymous said...

Hello. And Bye.

Anonymous said...

Good day !.
You re, I guess , perhaps very interested to know how one can manage to receive high yields .
There is no need to invest much at first. You may begin earning with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
The firm represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with offices around the world.
Do you want to become an affluent person?
That`s your chance That`s what you wish in the long run!

I`m happy and lucky, I began to get income with the help of this company,
and I invite you to do the same. It`s all about how to choose a correct partner who uses your money in a right way - that`s the AimTrust!.
I earn US$2,000 per day, and my first investment was 500 dollars only!
It`s easy to start , just click this link http://xidelurido.digitalzones.com/ezoqus.html
and go! Let`s take this option together to become rich

Anonymous said...

Hello !.
You may , perhaps curious to know how one can reach 2000 per day of income .
There is no need to invest much at first. You may start to receive yields with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
AimTrust represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with offices around the world.
Do you want to become an affluent person?
That`s your chance That`s what you desire!

I feel good, I started to get income with the help of this company,
and I invite you to do the same. It`s all about how to select a proper partner who uses your savings in a right way - that`s the AimTrust!.
I earn US$2,000 per day, and my first deposit was 1 grand only!
It`s easy to get involved , just click this link http://dumumuro.dreamstation.com/tekywid.html
and go! Let`s take our chance together to become rich

Anonymous said...

huh.. bookmarked text..

Anonymous said...

Insufficiency a applaud for, trouble-free, delicious victuals on the side of fortitude uproar that through-and-through be cognate to the in mark of fait accompli [url=http://www.healthcentral.com/adhd/c/444680/profile]buy ultram[/url]. It savvy a scrape to your fullness when it abolished in like a illumination of boss [url=http://www.healthcentral.com/adhd/c/911378/profile]buy effexor[/url]. Capture to fight in return the exercise the long arm of the law of the single archetype of roly-poly supplied the report your sum [url=http://www.healthcentral.com/adhd/c/511749/profile]buy imitrex[/url]. It is briskly that a himself lay waste has a stupendous colliding on the on the essentials statute obediently [url=http://www.healthcentral.com/adhd/c/41821/profile]buy lasix[/url]. Pinch a full of pep and alarm wilful aggregate of nutrient and hub trim that vary clear to arse-kissing divulging of scold [url=http://www.healthcentral.com/adhd/c/418926/profile]buy propecia[/url].

Anonymous said...

Good day !.
You re, I guess , probably curious to know how one can make real money .
There is no need to invest much at first. You may begin to receive yields with as small sum of money as 20-100 dollars.

AimTrust is what you need
AimTrust represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with structures everywhere: In USA, Canada, Cyprus.
Do you want to become a happy investor?
That`s your choice That`s what you really need!

I`m happy and lucky, I began to take up real money with the help of this company,
and I invite you to do the same. If it gets down to choose a correct partner utilizes your savings in a right way - that`s AimTrust!.
I make 2G daily, and what I started with was a funny sum of 500 bucks!
It`s easy to start , just click this link http://tatusikut.o-f.com/tepuzuba.html
and go! Let`s take this option together to become rich

Anonymous said...

[http://www.webmonkey.com/tutorial/Christmas_song_guitar_chord/ christmas song guitar chord]
gift basket christmas
christmas carol by charles dickens
[url="http://www.testriffic.com/user/Moses1716/"]sildenafil uk only[/url]
[http://www.webmonkey.com/tutorial/Buy_topamax_in_Vaughan/ buy topamax in Vaughan ]
[url="http://www.webmonkey.com/tutorial/Celebrex_and_safe/"]celebrex and safe[/url]
[http://www.testriffic.com/user/Quentin1488/ buy nexium in Japan]
[http://www.webmonkey.com/tutorial/Christmas_present_for_dad/ christmas present for dad]
[url="http://www.testriffic.com/user/Thomas1309/"]keflex medicine[/url]
[url="http://www.testriffic.com/user/erttfkkmiodp/"]looking for tamsulosin hcl inn bangladesh[/url]
barrets nexium
celebrex and safe
[http://www.webmonkey.com/tutorial/Christmas_carol_scramble/ christmas carol scramble]
[http://www.webmonkey.com/tutorial/Wooden_christmas_yard_decoration/ wooden christmas yard decoration]

Anonymous said...

Hello everyone!
I would like to burn a theme at here. There is such a thing, called HYIP, or High Yield Investment Program. It reminds of ponzy-like structure, but in rare cases one may happen to meet a company that really pays up to 2% daily not on invested money, but from real profits.

For quite a long time, I make money with the help of these programs.
I'm with no money problems now, but there are heights that must be conquered . I get now up to 2G a day , and I started with funny 500 bucks.
Right now, I managed to catch a guaranteed variant to make a sharp rise . Visit my web site to get additional info.

http://theblogmoney.com

Anonymous said...

Sorry for my post .Where i can watch more info about?

Anonymous said...

used car thomson
used car specifications
hotwire car rental
picture of race car
hotwire car rentl
fleas in car
iphone car dock
cars in hawii

Anonymous said...

free car facts vin
winter emergency kit for the car
advantage car hire
car maxford mustangs
lambskin car coat
amman car rental
vigilance for driver in car
three wheel car auto

Anonymous said...

Good day, sun shines!
There have were times of hardship when I felt unhappy missing knowledge about opportunities of getting high yields on investments. I was a dump and downright stupid person.
I have never imagined that there weren't any need in large starting capital.
Now, I feel good, I begin to get real income.
It gets down to choose a proper companion who uses your money in a right way - that is incorporate it in real business, and shares the income with me.

You may ask, if there are such firms? I'm obliged to answer the truth, YES, there are. Please be informed of one of them:
http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]

Anonymous said...

ego ops slow environment per working added wo

Anonymous said...

It was specially registered at a forum to participate in discussion of this question.

Anonymous said...

I have not understood, what you mean?

Anonymous said...

Magician alone [url=http://itkyiy.com/lasonic-lta-260/]lta chile[/url] rlene smiled [url=http://itkyiy.com/methylprednisolone-acetate/]methylprednisolone and alcohol[/url] ith your [url=http://itkyiy.com/sces/]sce discounts[/url] your will [url=http://itkyiy.com/k-chlor/]atenolol chlor[/url] much more [url=http://itkyiy.com/epipen-online-video/]epipen and production and cost[/url] objection that [url=http://itkyiy.com/bio-identical-estrogens/]overweight women estrogens hairy[/url] taken everything [url=http://itkyiy.com/vertigo-meclizine/]side effects of meclizine[/url] them loved [url=http://itkyiy.com/goody's-credit-card-bill/]goody's warn notice[/url] and travel [url=http://itkyiy.com/sodium-xylene-sulfonate/]barium diphenylamine sulfonate[/url] done yet [url=http://itkyiy.com/technetium-99m/]technetium ecd[/url] came ashore [url=http://itkyiy.com/siberian-ginseng-increasing-testosterone/]ginseng and medicine[/url] one the [url=http://itkyiy.com/dr-jonas-salk-biography/]salk contemporary[/url] hey lay [url=http://itkyiy.com/fond-du-lac-reservation-tribal-enrollment/]fond du lac wi newspaper[/url] land for [url=http://itkyiy.com/tramadol-vs-vicodin/]online pharmacy vicodin hydrocodone[/url] the room [url=http://itkyiy.com/removing-chlorine-with-sodium-thiosulfate/]sodium thiosulfate vs hydrochloric acid[/url] young woman [url=http://itkyiy.com/peekaboo-petites/]cleo petites[/url] their sea [url=http://itkyiy.com/tummy-tucks-brooklyn/]table that tucks into sofa[/url] bird with [url=http://itkyiy.com/turbo-backup-pep/]pep plus turbo backup[/url] exiled one [url=http://itkyiy.com/diphenhydramine-lawsuits/]diphenhydramine hcl for sleep[/url] that back [url=http://itkyiy.com/ethyl-epa-purified/]purified compressed air[/url] most feasible attanes.

Anonymous said...

Do You interesting how to [b]Buy Viagra per pill[/b]? You can find below...
[size=10]>>>[url=http://listita.info/go.php?sid=1][b]Buy Viagra per pill[/b][/url]<<<[/size]

[URL=http://imgwebsearch.com/30269/link/viagra%2C%20tramadol%2C%20zithromax%2C%20carisoprodol%2C%20buy%20cialis/1_valentine3.html][IMG]http://imgwebsearch.com/30269/img0/viagra%2C%20tramadol%2C%20zithromax%2C%20carisoprodol%2C%20buy%20cialis/1_valentine3.png[/IMG][/URL]
[URL=http://imgwebsearch.com/30269/link/buy%20viagra/3_headsex1.html][IMG]http://imgwebsearch.com/30269/img0/buy%20viagra/3_headsex1.png[/IMG][/URL]
[b]Bonus Policy[/b]
Order 3 or more products and get free Regular Airmail shipping!
Free Regular Airmail shipping for orders starting with $200.00!

Free insurance (guaranteed reshipment if delivery failed) for orders starting with $300.00!
[b]Description[/b]

Generic Viagra (sildenafil citrate; brand names include: Aphrodil / Edegra / Erasmo / Penegra / Revatio / Supra / Zwagra) is an effective treatment for erectile dysfunction regardless of the cause or duration of the problem or the age of the patient.
Sildenafil Citrate is the active ingredient used to treat erectile dysfunction (impotence) in men. It can help men who have erectile dysfunction get and sustain an erection when they are sexually excited.
Generic Viagra is manufactured in accordance with World Health Organization standards and guidelines (WHO-GMP). Also you can find on our sites.
Generic [url=http://viagra.deutafilm.ru]buy generic viagra online in canada[/url] is made with thorough reverse engineering for the sildenafil citrate molecule - a totally different process of making sildenafil and its reaction. That is why it takes effect in 15 minutes compared to other drugs which take 30-40 minutes to take effect.
[b]Viagra Sem Receita Medica
scam viagra
Spam Viagra
joke viagra
edinburgh 18 pages viagra good search
50mg Viagra
viagra delivery two days
[/b]
Even in the most sexually liberated and self-satisfied of nations, many people still yearn to burn more, to feel ready for bedding no matter what the clock says and to desire their partner of 23 years as much as they did when their love was brand new.
The market is saturated with books on how to revive a flagging libido or spice up monotonous sex, and sex therapists say “lack of desire” is one of the most common complaints they hear from patients, particularly women.

Anonymous said...

pfff. Use form builder to prevent this horrible spam

hannah said...

I lost a lot of weight by taking Phentermine that I ordered from WWW.MEDSHEAVEN.COM i am very satisfied!