Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with confirm code

    Can anyone fix thís code,


    function SubmitContent() {


    if (document.editor.subject.value == "") {
    var x=window.confirm("Du har inte angett en ämne.\nVill du fortsätta ändå?")

    if (x) {
    document.editor.MAIL.value = idContent.document.body.innerHTML;
    document.editor.SEND.disabled = true;
    return true;
    }
    else {
    document.editor.subject.focus();
    return false;
    }
    }
    else {
    document.editor.SEND.disabled = true;
    document.editor.MAIL.value = idContent.document.body.innerHTML;
    return true;
    }

    thanks in before

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What's wrong with it? I could guess, but I'd most likely waste both our time doing so.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well I tried many kind of sokutions, but on all it doesn't matter if you press OK or Cancel, Both will submit the form

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, I suppose I'll have to guess.

    Maybe you have something like this

    <form name="editor" onsubmit="SubmitContent()">

    But it isn't working -- so you need to change it to this

    <form name="editor" onsubmit="return SubmitContent()">

    Am I right?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    New Coder
    Join Date
    Jul 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maaan you're god


  •  

    Posting Permissions

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