event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick

    event

    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
  • Paul Wellner Bou

    #2
    Re: event

    Hi,

    Patrick wrote:
    [color=blue]
    > 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...[/color]

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

    <form onsubmit="retur n 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.

    Comment

    • W d'Anjos

      #3
      Re: event

      Can't you just call the function that handles the event?

      -Wagner

      Patrick <patrick@armage .nospamthanx.or g> wrote in message news:<slrnbo5l8 g.fsj.patrick@a lcyone.nebuleus e.ici>...[color=blue]
      > 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 ?[/color]

      Comment

      • Patrick

        #4
        Re: event

        W d'Anjos wrote:[color=blue]
        > Can't you just call the function that handles the event?
        >[/color]

        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

        Comment

        Working...