Butt load of docs wrong or bug in form plugin processing???

genyded

Active Member
Hi all,

This one is information for the Fabrik team (Rob, Hugh or whoever)...

Either most-all of the documentation for the php form plug-in is wrong (or that plugin has a bug)....

All of the documentation says to use things like:

PHP:
$name = $formModel->formData['tablename___name'];
 
if ($name === 'rob')
{
  $formModel->updateFormData('tablename___sport', 'badminton', true);
}

.. for all areas including onLoad and the events up to that point. However none of that will work up to and including the onLoad event. The only thing (through hours of debugging I found) that will work are things like:

PHP:
$name = $formModel->data['tablename___name'];
 
if ($name === 'rob')
{
  $formModel->data['tablename___sport'] = 'badminton';
}

Please note that most or all of the documentation related to element references prior to for events prior to and including onLoad events is incorrect (or the code is). This is potentially very frustrating to (especially new) users. The former above do work as expected for and other events such as onBeforeProcess and the rest of the downstream events in the php plugin. The other form plugins besides php also seem to use the first example just fine in the onLoad and upstream events as well - at least the others I have used to date.

No biggie for me now that I figured this out, and as I said - your call on if you feel this is a "bug" or not, but if not docs should probably be updated soon.

Thanks,
Dale
 
In general, $formModel->formData is used when processing a form submission, $formModel->data is used when building a form for rendering. Also note that it's _formData in 3.0, and just formData in 3.1.

We have considered attempting to make this consistent, as it kinda bugs us as well, and at one point we had a fork of the 3.1 code where we attempted to re-factor and always use $formModel->formData, and also improve the consistency of how we represent data (JSON strings versus arrays, etc) but it proved a lot nastier than we had hoped.

I seem to recall that the original reason for using the different names, many years ago in our dim and distant past, is that the data is different. Element data being rendered for display is different to data being submitted. As mentioned above, we have looked at making it more consistent overall, but there is simply too much legacy code and weight of Fabrik history pressing down on it to make this viable.

As for the documentation, most of what there is is really written from the perspective of "submission plugins", rather than "rendering plugins". We should obviously make that clearer, but there's only two of us, and only 24 hours in a day.

So ... it's one of those "it is what it is" things. We're not going to expend any energy on it as this point, as we're now focusing all of our development time in to the ground up rewrite for 4.0.

BTW, we have a Skype chat for folk who are interested in expending any significant amount of energy on Fabrik related coding and/or community support. Let me know if you'd like to join that.

-- hugh
 
Thanks Hugh,

I appreciate the response! I also fully understand the reasoning behind focusing on 4.0. I am currently the sole developer rebuilding a 15 year old online conference submission and content management system for a very demanding client. I am basing it on Joomla to jump start the menus, users, and such, but the real work is almost 100% Fabrik at this point. It is a VERY complex, large, and data intensive application. While I have hit a few Fabrik hiccups along the way, I been able to overcome then one by one and in a few months hope to have what may become a Fabrik showcase (albeit 3.x). I'll be using just about aspect of Fabrik (except maybe packages) at one point or another.

So like you and Rob, I am quite time constrained for now, so as much as I'd love to, I'll have to decline any active commitment for 4.0 involvement. However, I will continue to help out in the forums as much as I can and keep my eyes and ears open for beta announcements or anything else that I may be able to dedicate some time to. I would imagine to leap to 4.x will come for me at some point, so it will be mutually beneficial. Also once my current project reaches a point of stability, I plan to launch my own venture that will involve Fabrik.

So to recap... I'll still be around quite for while and will help out when and where I can. I know that Skype has come a long way from the early days, but I am still personally adverse to it, so you won't see me there anytime soon. But here on the forum and anywhere else I can help out, I am glad to. I have only been using Fabrik for a couple of months now, so I am still learning as well, but I am also a pretty sharp tack and pick things up very quickly, so hopefully I'll be of some benefit. I am trying to get my client to spring for a Fabrik subscription, but if they don't soon, I'll buy the highest I can afford.

See you around the neighborhood and again thanks for taking the time to respond. I really do know how busy you 2 must be!

Regards,
Dale
 
The Skype chat is 3.x centric, and we only do IM, no voice or video. It's basically Rob and I, plus the half dozen or so core "community" folk who provide absolutely invaluable help and support (Troester, Felix, Sophist, Jean Francois, Jaanus, etc). It's a place to sanity check each other, help keep issues on the radar, get help with thorny issues, etc.

I really think you would find it useful, especially if you like helping out on community forums. I understand your reluctance with Skype, I avoided it for years. But I finally had to give in a few years ago, as the majority of my IM corespondents had switched to it, and I've since uninstalled everything else, after I got fed up with running half a dozen different IM clients.

The main issue is, Rob and I typically wouldn't see much (well, any, to be honest) of what you post in Community. We are simply max'ed out keeping up with the paid subs, and doing development. So we very rarely have time to scan Community issues. I only saw your question in this post because I noticed you starting to help out, so I've been lurking, peeking over your shoulder just to make sure you had a handle on things.

So the Skype chat is a way you can save yourself time and energy, by bouncing things off the Brain Trust (such as it is) rather than spending your time spinning wheels trying to work through the code yourself, which can be a very time consuming proposition - like any code that grew over many years, without much by way of formal specification, it's not the most well structured or easy to read code!

Anyway ... up to you ... but I'd say it's worth overcoming your Skype allergy, to save yourself a lot of time.

-- hugh
 
I am 'cheesegrits' (hugh dot messenger at gmail dot you know what).

Include some Fabrik related words in your contact request.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top