When editing a widget, all the previously made selections are empty

Ok, I know this has nothing to do with any wpmu-dev products but I ‘m trying to build a widget and I’m just doing something wrong. I hope someone else will be able to spot it ’cause I can’t see it.

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

The first one 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… :stuck_out_tongue: ) the file responsible for all this is here: https://gist.github.com/3003040 the lines in question are 77-252

  • Kimberly
    • Champion of Loops

    Oh what project!

    I don’t have anything particular to share, however you can check out this link and look at the portion below

    The final stage of this control function is to generate the widget form and populate it with any existing values. So first, if it’s the first time this instance is being called, display an empty form. Otherwise, get the widget values corresponding to the current instance, identified by $options[$number].

    Maybe you will find something useful in there?

    Best of Luck! Wish I could do more!


  • aristath
    • Recruit

    Thank you for the link!

    I read it and it doesn’t seem to me that there’s anything wrong…

    What really drives me crazy is that the “title” and “main text” fields are almost identical to the ones that are not being displayed, the only thing that changes is their name!

  • Mark Wallace
    • Learn-ing-er

    Hi! aristath

    I’m not much on coding, but I have a knack for spotting things that don’t seem right, so I will look and see if I can be of help. I was looking for you; because I remember you were hacking away at MarketPress. Another member and I have similar problems with MarketPress. I would give you Rep. Points for fixing my problem. I believe you would be a great asset to this community! Here is a link to a thread with both of our issues. Meanwhile I will see if I can spot something for you.


  • Mark Wallace
    • Learn-ing-er

    What if the user closes without saving the edit the second time, is the first edit info erased or still present?

    In lines 83-85 could this be repeating on the second edit, and cleaning out the 1st edit.

    I am also looking at 161-165. I need to go to my desktop so I can use two monitors and compare your other files.

  • aristath
    • Recruit

    @mtb1701 Thank you for your kind words!

    I’ve already commented on the issue you posted and I’ll try to help out as much as I can!

    Now on your previous comment:

    What if the user closes without saving the edit the second time, is the first edit info erased or still present?

    If the user closes without saving, then the entries he made before opening it are still present.

    This widget has the following fields:















    If lines 83-85 or line 171 were a problem, they would be a problem for all fields.

    Instead, the “title” and “maintext” fields don’t have any issues. only the other ones do.

  • Mark Wallace
    • Learn-ing-er

    Hi aristath!

    Lines: 194 – 205 I see all English This is title and main text

    Then from line 206 down I see Greek. These are for the fields in question.

    Everywhere else they appear to be the same. This is the only difference I can find at the moment. Let me know if you find it there. If not I will look again later.

  • Mark Wallace
    • Learn-ing-er

    Hi aristath

    Did you get this solved? I have a little free time tonight if not. I’ve noticed you have been very busy with other threads in the forums.

    Also i am sorry about that other remembers response. It was ungrateful and kind of rude.

    Here is the problem i was having, if you are still interested in working on it. I know you have become very familiar with MarketPress. The last two or three comments on this thread get to the solution. Tell me how many points you want, and/or other compensation for your time. Thanks aristath

  • aristath
    • Recruit

    @mtb1701 Unfortunately this one got left back a bit… :slight_smile: I ‘ll try building it again tonight from the ground-up, see if I can make it work. :slight_smile:

    Don’t worry, it wasn’t rude. It just needs A LOT of coding, probably a whole plugin altering some Marketpress functions and I’m already working more than 14 hours/day. I just can’t do it. :slight_smile:

    Of course I’m interested in working on a solution, no points/compensation needed.

    If I manage to help someone I do it because I like helping.

    Unfortunately you have to understand that IF the solution to a problem in this community takes up more than 2-3 hours of coding I give up. Not because I don’t want to help but because I just have some deadlines until the end of August (3 BIG projects) and I ‘m trying to make them happen.

  • Mark Wallace
    • Learn-ing-er

    Not a problem, I am going to find a work around for now, if you get a chance to look in to before the end of the year; that would be fine. I have about 9-12 website in different countries that i am trying to bring together in 2013. This is just a part of it. Thanks Pal.

    And I have no doubt you’re going to make your deadlines with time to spare. You seem very diligent. Could you send me a link to your business website? I am planning on expanding into the Euro zone late 2013. Would like to get some quotes from you in September.

  • aristath
    • Recruit

    My site is unfortunately really old, I haven’t updated it in more than a year so I’m ashamed of it. :stuck_out_tongue: But feel free to add me on G+ or Twitter (you can find them on my profile).

    I’m always looking for good people to work with and expand so I ‘d like that! :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.