Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

here's what 's happening: The widget I'm building is rendering a title, a body and some buttons bellow it. The user can change the title, the body, the label and the link of each button. When the user enters some options and saves the widget, everything is rendered perfectly fine. BUT when he tries to edit the widget again to make some changes, all the options he previously entered are gone. To make my point clear, I've attached 3 screenshots here: https://docs.google.com/file/d/0B02M3q19p_o8c3pTdGJHRmc3V1E/edit

The first image is when editing the widget to enter some options. The second is the widget after we save it with the options we entered on the first screenshot. The third is when re-editing the widget.

Notice that on the 3d screenshot the previous options for the buttons are empty.

If anyone feels like helping (please do... :P ) the code responsible for all this is here: https://gist.github.com/3004860

This is driving me CRAZY

share|improve this question
What I want to achieve using this is a customizable top region like on twitter.github.com/bootstrap/index.html but since it's a Wordpress Multisite installation users will have to edit and change this part of their site according to their taste. – Aris Jun 27 '12 at 15:53
I use Front End Editor wordpress.org/extend/plugins/front-end-editor to allow users to edit this widget. – Aris Jun 27 '12 at 15:59

closed as too localized by Stephen Harris, kaiser, toscho Oct 3 '12 at 0:42

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

When you display the widget, you need to set the HTML value attribute of the <input> boxes to whatever they had previously.

When the user fills out another text box and leaves the rest blank, the program saves the contents of all the textboxes - including the blank ones that previously had values.

share|improve this answer
I think I 've done that... If you take a llok at lines 140-173 at gist.github.com/3004860 you'll see that (I think) I did! for example <input id="<?php echo esc_attr($this->get_field_id('link_target_white')); ?>" name="<?php echo esc_attr($this->get_field_name('link_target_white')); ?>" type="text" value="<?php echo esc_attr($link_target_white); ?>" /> – Aris Jul 2 '12 at 20:34
Could the line if (!isset($instance['maintext'])) { $instance['maintext'] = ''; } be causing problems? – fdsa Jul 2 '12 at 21:28
That's what I thought of at first too, but the "maintext" and the "title" fields don't have any problems!! Which is nuts 'cause the others fields that have the problem are actually clones of those! – Aris Jul 3 '12 at 1:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.