Title: Widget options &#8211; Saving changes view
Last modified: July 12, 2017

---

# Widget options – Saving changes view

 *  [tdk1069](https://wordpress.org/support/users/tdk1069/)
 * (@tdk1069)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/widget-options-saving-changes-view/)
 * Hi,
    First off I’m not a “wordpress Developer” but I know PHP and doing a small
   favour for a friend. I have a small widget to pull a game character display from
   a remote site, process it and display it. This all works fine. So I converted
   it into a simple WP plugin.
 * I created a couple of options to select a char and a cached timeout to play nice
   with the third party API, but I found something odd happening. I use a html select
   drop down to set a cache time out. When I Save the settings in WP, the <options
   > tags get moved outside of the <select> tag.
 * The (simple I know) php…
 *     ```
       <p>
       <label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php _e( 'Char ID:' ); ?></label> 
       <input class="widefat" id="<?php echo $this->get_field_id( 'id' ); ?>" name="<?php echo $this->get_field_name( 'id' ); ?>" type="text" value="<?php echo esc_attr( $id ); ?>" />
       <label for="<?php echo $this->get_field_id( 'cache_timeout' ); ?>"><?php _e( 'Cache Timeout:' ); ?></label> 
       <select class="widefat" id="<?php echo $this->get_field_id( 'cache_timeout' ); ?>" name="<?php echo $this->get_field_name( 'cache_timeout' ); ?>"/>
       	<option value="15" <?php selected( $instance['cache_timeout'], '15'); ?>>15 Minutes</option>
       	<option value="30" <?php selected( $instance['cache_timeout'], '30'); ?>>30 Minutes</option>
       	<option value="45" <?php selected( $instance['cache_timeout'], '45'); ?>>45 Minutes</option>
       	<option value="60" <?php selected( $instance['cache_timeout'], '60'); ?>>60 Minutes</option>
       </select>
       </p>
       ```
   
 * When hitting save, this is what appears in inspect elements.
 *     ```
       <label for="widget-xivdbprofile-2-id">Char ID:</label> 
       <input class="widefat" id="widget-xivdbprofile-2-id" name="widget-xivdbprofile[2][id]" value="6318718" type="text">
       <label for="widget-xivdbprofile-2-cache_timeout">Cache Timeout:</label> 
       <select class="widefat" id="widget-xivdbprofile-2-cache_timeout" name="widget-xivdbprofile[2][cache_timeout]"></select>
       	<option value="15">15 Minutes</option>
       	<option value="30">30 Minutes</option>
       	<option value="45">45 Minutes</option>
       	<option value="60" selected="selected">60 Minutes</option>
       ```
   
 * I’m sure I am missing something, or doing something dim…. Any pointers would 
   be appreciated… The ID field worked fine. So I added the cache timeout to be 
   nice and reduce any loading delays. (worst case I’ll make it a number entry field
   instead) thanks (ps. if this is the wrong place sorry!)
    -  This topic was modified 8 years, 11 months ago by [tdk1069](https://wordpress.org/support/users/tdk1069/).

Viewing 1 replies (of 1 total)

 *  Moderator [tobifjellner (Tor-Bjorn “Tobi” Fjellner)](https://wordpress.org/support/users/tobifjellner/)
 * (@tobifjellner)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/widget-options-saving-changes-view/#post-9309021)
 * Since WordPress 4.8, the text widget is enhanced with TinyMCE. This is great 
   news if you want rich text formatting, but not so good when you try to squeeze
   in javascript or less common html tags.
    Try using the plugin “Classic text widget”.
 * Good luck!

Viewing 1 replies (of 1 total)

The topic ‘Widget options – Saving changes view’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [tobifjellner (Tor-Bjorn “Tobi” Fjellner)](https://wordpress.org/support/users/tobifjellner/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/widget-options-saving-changes-view/#post-9309021)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
