Support » Fixing WordPress » Widget text updates outside of the textarea

  • 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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Forum Moderator

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

    esmi

    (@esmi)

    Forum Moderator

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

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

    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">
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Widget text updates outside of the textarea’ is closed to new replies.