Having just gone at this for several hours for a client I can confirm that you’re not the only one with this problem.
The issue is that the plugin doesn’t properly serialize some option element subclasses, so that when the form is stored in the session the available options for a drop-down aren’t saved with it.
This issue will only appear if ajax submission breaks or is disabled for some reason.
If there is a repo I can commit my “fix” to I will gladly provide you (and indeed Cimatti) with updated code that works around at least this specific case. I’ve not taken the time yet to see if other form elements might also succumb to this issue.
Hi,
I always use the ajax submit, so maybe I have missed this odd bug.
@hanra can you just post here the patch, so I can check it out and integrate it? I may give you credits in the changelog in the form you prefer
Since the issue was with serialization of the form elements my solution was to override the __sleep method on the Select class to include the options.
Now I think about it, the better solution is to add this to the OptionElement class in PFBC/OptionElement.php:
public function __sleep() {
$fields = parent::__sleep();
array_push($fields, "options");
return $fields;
}
More than happy to get credits if you use this 🙂
Tom
Ah, wait, now I remember why I created the class classes/Element/Select.php about 5 months ago and included it in the version I released 2 days ago. Now I use this class for selects, and the only difference is that it extends classes/Element/OptionElement.php that already serializes the $options array.
Things in folder PFBC are from a third party library, so I prefer not to touch files inside it.
I’m sorry for having deluded you, Hanra 🙂 , but with the latest version this should be already fixed