WordPress.org

Ready to get started?Download WordPress

Forums

Widget text updates outside of the textarea (6 posts)

  1. duncmorley
    Member
    Posted 2 years ago #

    Hi there

    I am building my own widget. I have the following code set up for a textarea.

    <textarea class="widefat" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>" type="text" /><?php echo $instance['text']; ?></textarea>

    When i first load the widget, my text sits within the textarea. As soon as i hit the save button, the textarea clears and the updated text sits underneath the textarea box.

    I would like the text to stay in the textarea at all times. Does anyone know how to achieve this.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

  3. duncmorley
    Member
    Posted 2 years ago #

    I have. That is the tutorial i have used to create my widget. This doesn't help me with my question though.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Try validating the page markup. Sounds like you have a missing closing tag.

  5. duncmorley
    Member
    Posted 2 years ago #

    I'm not. I know this because the text is correctly placed before I hit the save button.

  6. Sinopa
    Member
    Posted 2 years ago #

    It's your trailing / at the end of textarea

    <textarea class="widefat" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>" type="text" />

    Try this :)

    <textarea class="widefat" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>" type="text">

Topic Closed

This topic has been closed to new replies.

About this Topic