SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Submit problem

  1. #1
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submit problem

    Hi!

    I'm trying out Kevin Roth's cross-browser rich text editor(http://www.kevinroth.com/rte/demo.htm), but I can't even get it to submit the form. Nothing happens when I click the submit button. From what I understand in the source, it should submit if you change a return type from false to true, but I've tried that without a result.

    Have anyone tried it and gotten it to work? Any idea what I need to change to make it work?

    Vidar

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any idea what I need to change to make it work?
    To suggest any changes, we'd probably need to see what you're using, dontcha think?
    ::: certified wild guess :::

  3. #3
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by adios
    To suggest any changes, we'd probably need to see what you're using, dontcha think?
    I'm using the same code as in the link, but with one change:

    function submitForm() {
    updateRTE('rte1');
    alert(document.RTEDemo.rte1.value);

    //change the following line to true to submit form
    return true;
    }

    I've changed the return from false to true. This is the complete code(except a javascript file I haven't touched):

    Code:
    <form name="RTEDemo" action="insertrte.jsp" method="post">
    Title: <input type="text" name="headline" size="50"><br>
    <script language="JavaScript" type="text/javascript">
    
    function submitForm() {
    	updateRTE('rte1');
    	alert(document.RTEDemo.rte1.value);
    
    	//change the following line to true to submit form
    	return true;
    }
    
    //writeRichText(fieldname, html, width, height, buttons)
    writeRichText('rte1', 'here's the "<em>preloaded</em> <b>content</b>"', 520, 200, true);
    
    //uncomment this section to see a demo of multiple RTE's on one page
    //document.writeln('<br><br>');
    //writeRichText('rte2', '', 450, 100, true);
    
    </script>
    <noscript><p><b>Javascript must be enabled to use this form.</b></p></noscript>
    
    <p>Click submit to show the value of the text box.</p>
    <p><input type="button" name="submit" value="Submit" onClick="return submitForm()"></p>

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Notice any differences here?
    Theirs:
    Code:
    <input type="submit" name="submit" value="Submit">
    Yours:
    Code:
    <input type="button" name="submit" value="Submit" onClick="return submitForm()">
    Naming a button "submit" (a bad idea, btw) doesn't make it a submit button. It's the 'type' that determines that. The only other native form submitter is <input type="image">, in case you wanted a graphic instead.
    ::: certified wild guess :::

  5. #5
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by adios
    Notice any differences here?
    Theirs:
    Code:
    <input type="submit" name="submit" value="Submit">
    Yours:
    Code:
    <input type="button" name="submit" value="Submit" onClick="return submitForm()">
    Naming a button "submit" (a bad idea, btw) doesn't make it a submit button. It's the 'type' that determines that. The only other native form submitter is <input type="image">, in case you wanted a graphic instead.
    Thanks a lot! Embarrasing that I didn't catch that error. I wonder how I managed to change that code..

    Vidar


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
  •