By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

event

P: n/a
Hi,

I'm looking for a way to "throw" an event.

Let's me explain. I have a form with a button. When you click the button
a js function is called to confirm before submitting

ex. : (if confirm(...) theForm.submit()).

Ok, that works.

Now, in the form I'm using HTMLArea (see sourceforge.net) which reacts on
the 'submit' event.

My problem is that when the function form.submit is called, the onsubmit
event is not invoked (see MSDN doc). So the HTMLArea doesn't reacts.

I need a confirmation before submitting but then I can't submit because it
doesn't invoke the needed submit event...

So I'm looking for a way to "throw" an event (as I can throw exception
in java).

Do you know a trick/url/doc/rtfm that can help me ?

--
Patrick
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Patrick wrote:
My problem is that when the function form.submit is called, the onsubmit
event is not invoked (see MSDN doc). So the HTMLArea doesn't reacts.

I need a confirmation before submitting but then I can't submit because it
doesn't invoke the needed submit event...


Just call a function on the event onSubmit, returning the
result of this function.

<form onsubmit="return function_name();" ...>

Check your values or wathever, if they are ok, let the function
return true, if not, let the function return false.
If JavaScript is enabled at the client's browser the form
won't be submitted if the function returnds false.

If not, you wont be able to check the values with JavaScript
anyway. But in those cases, never trust to clientside scripting,
make sure to check all you have to check with the serverside script
where the values are POSTed (or GETed) to, too.

....ah ok, I just reread your question, you aren't checking the
values, you are asking something with a confirm box. But the
procedure is the same.

Saludo
Paul.
Jul 20 '05 #2

P: n/a
Can't you just call the function that handles the event?

-Wagner

Patrick <pa*****@armage.nospamthanx.org> wrote in message news:<sl********************@alcyone.nebuleuse.ici >...
Hi,

I'm looking for a way to "throw" an event.

Let's me explain. I have a form with a button. When you click the button
a js function is called to confirm before submitting

ex. : (if confirm(...) theForm.submit()).

Ok, that works.

Now, in the form I'm using HTMLArea (see sourceforge.net) which reacts on
the 'submit' event.

My problem is that when the function form.submit is called, the onsubmit
event is not invoked (see MSDN doc). So the HTMLArea doesn't reacts.

I need a confirmation before submitting but then I can't submit because it
doesn't invoke the needed submit event...

So I'm looking for a way to "throw" an event (as I can throw exception
in java).

Do you know a trick/url/doc/rtfm that can help me ?

Jul 20 '05 #3

P: n/a
W d'Anjos wrote:
Can't you just call the function that handles the event?


Hmm it's a bit complicated as there are several objects that reacts to
this event 'onsubmit'. I would have to call the function for each of
these objects.

As Paul Wellner Bou answered (sorry, I see your post on google as my
provider doesn't give me all the posts...), I will change my code to
use the onsubmit on the form.

Many thanks,

--
Patrick
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.