submit form using a function and a confirm box

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

    submit form using a function and a confirm box

    I am submitting a form using an image as the link to a js file.
    The image calls a js function which checks fields- issuing alerts for
    errors - if no errors it then submits the form.
    I would like to have a final confirm box run from the function before the
    form is submitted.
    I guess I would have to use the return statement somehow but I can't see
    quite how.
    Any help gratefully accepted

    John
    --
    _______________ _______________ _______________ _______________ ________
    The information in this message is confidential and is intended solely
    for the addressee. If you are not the recipient intended by SiteWeave,
    any disclosure, copying, distribution or any action taken or omitted to
    be taken in reliance on it, is prohibited.

    Please note that all business is subject to our terms and conditions,
    available upon request or through our website.

    Web Design specialists at Siteweave in Hampshire, offer professional internet services including website design, content management systems (CMS), e-commerce solutions, SEO, PPC and Social Media.

    _______________ _______________ _______________ _______________ ________



  • btopenworld

    #2
    Re: submit form using a function and a confirm box


    "Janwillem Borleffs" <jwb@jwbfoto.de mon.nl> wrote in message
    news:3f06ea80$0 $28896$1b62eedf @news.euronet.n l...[color=blue]
    >
    > "btopenworl d" <john@siteweave .net> schreef in bericht
    > news:be6od1$1u5 $1@sparta.btint ernet.com...[color=green]
    > > I am submitting a form using an image as the link to a js file.
    > > The image calls a js function which checks fields- issuing alerts for
    > > errors - if no errors it then submits the form.
    > > I would like to have a final confirm box run from the function before[/color][/color]
    the[color=blue][color=green]
    > > form is submitted.
    > > I guess I would have to use the return statement somehow but I can't see
    > > quite how.
    > > Any help gratefully accepted
    > >[/color]
    >
    > A simple
    >
    > <form onsubmit="if (formValidated( )) return confirm('Submit form?'); else
    > return false"....>
    >
    > should to do it.
    >
    > JW
    >
    >
    >[/color]
    thanks - could you tell me what the end of the validation script does - at
    the moment it is submitting the form - document.form1. submit() - this seems
    to bypass the onsubmit part of the form. I can't use a normal submit button
    because I am using an image to trigger the submission

    thanks
    John


    Comment

    • Richard Cornford

      #3
      Re: submit form using a function and a confirm box

      "btopenworl d" <john@siteweave .net> wrote in message
      news:be6sav$2qr $1@hercules.bti nternet.com...
      <snip>[color=blue]
      > ... . I can't use a normal submit button
      > because I am using an image to trigger the submission[/color]

      <input type="image" src="example.gi f">

      Richard.


      Comment

      • Janwillem Borleffs

        #4
        Re: submit form using a function and a confirm box


        "Richard Cornford" <Richard@litote s.demon.co.uk> schreef in bericht
        news:be6st6$30m $1$8300dec7@new s.demon.co.uk.. .[color=blue]
        >
        > Or maybe:-
        >
        > <form onsubmit="retur n (formValidated( )&& confirm('Submit form?'));">
        >[/color]

        Yes, you're right...

        JW



        Comment

        • btopenworld

          #5
          Re: submit form using a function and a confirm box


          "Janwillem Borleffs" <jwb@jwbfoto.de mon.nl> wrote in message
          news:3f073d36$0 $28904$1b62eedf @news.euronet.n l...[color=blue]
          >
          > "Richard Cornford" <Richard@litote s.demon.co.uk> schreef in bericht
          > news:be6st6$30m $1$8300dec7@new s.demon.co.uk.. .[color=green]
          > >
          > > Or maybe:-
          > >
          > > <form onsubmit="retur n (formValidated( )&& confirm('Submit form?'));">
          > >[/color]
          >
          > Yes, you're right...
          >
          > JW
          >
          >
          >[/color]

          Is the onsubmit called if the form is submitted via a function?

          John


          Comment

          Working...