Results 1 to 2 of 2

Thread: Textarea input wiped out after form submission

  1. #1
    Join Date
    Feb 2015
    Location
    Dallas, TX
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Textarea input wiped out after form submission

    And this is an issue because if the user has made a mistake on the form and has to make a correction, he/she also now has to retype everything in the textarea again before re-submission. And the textarea's the only input device that loses its input. Input boxes are fine, as are the selected select options. Is this a natural behavior? Is there a way around it?

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    You can use a script like this to retain data (JavaScript): http://www.dynamicdrive.com/dynamici...tosaveform.htm

    You can also use PHP to post the data back to the form field once it has been submitted - something like this (very simple example);

    Top of page;
    PHP Code:
    $comment $_POST['comment']; 
    Markup;
    PHP Code:
    <input type="text" name="comment" value="<?php echo $comment ?>">
    or
    PHP Code:
    <textarea name="comment"><?php echo $comment ?></textarea>
    If you need more help, please provide a copy of your script.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Replies: 4
    Last Post: 08-09-2010, 01:26 PM
  2. Replies: 5
    Last Post: 04-29-2009, 03:42 AM
  3. ajax form submission, but with a file input
    By Irishjugg in forum JavaScript
    Replies: 3
    Last Post: 12-16-2008, 10:46 PM
  4. IE data loss in textarea input bug???
    By srfrantz in forum ASP
    Replies: 4
    Last Post: 01-21-2008, 12:30 AM
  5. Textarea Input Limiter
    By icesolid in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-23-2006, 04:45 PM

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
  •