Results 1 to 6 of 6

Thread: Are you sure?

  1. #1
    Join Date
    Sep 2007
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Are you sure?

    how to display this question before submiting a form?

    i need "yes" or "abort" for answer

    Samba di?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    <form onSubmit="return confirm('Are you sure?');">
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Code:
    <form onsubmit="javascript:confirm('some question');"

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    djr33's idea is better because it will actually stop the form from being submitted if the answer is no.

    If this is a mission critical aspect of your form though, some server side method, or at least some non-javascript backup should be employed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    alert('You have agreed to give us money!');

    Well, I'm not sure what a backup method would do... I guess just notify the user. If it is critical, I'd use a checkbox instead, which is easier to integrate with both JS and PHP/etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    A back up method could be done several ways. And, as mentioned may not be needed if the situation isn't all that critical. One could present the user with a different form if javascript is disabled. Filling out that form and submitting it would only get you to a second identical looking form that is already filled out. The only difference being that there could be a header on that new page saying 'Are you sure?' or 'Is this Information Correct?' The submit button's value for that second form could be 'Yes'.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •