This is a "is it possible" question

Racmitch

Member
I want to make a form in fabrik that would be left side is text right side is a text field or something of that nature. basically a standard form. but I would like an individual user (everything on this site is unique to a user id) to be able to, if needed change the text on the left hand side. I know I can make a field with a place holder, but I want it to look like text not a form field any suggestions?
 
Hmmm. So basically "dynamic labels"?

I don't think you could do it with actual element labels. You might be able to fake it using elements for the "labels", although then of course you've got the issue of editing the pseudo-labels.

Are the 'labels' unique to each form, ie, when you say "if needed change the text on the left hand side", is that on a per form basis, or list wide, so if they change the label text, it changes it for all forms?

If the latter, then your labels would have to be stored in a separate table ... say 'element_labels', like ...

id, user_id, element_id, label

... where element_id is the Fabrik element ID of the coresponding element on the main form.

Then use a join for each 'label' element to 'element_labels', which you default to the coresponding record:

Code:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id')->from('element_labels')->where('element_id = ' . (int)$this->getElement()->id)->where('user_id = ' . (int)JFactory::getUser()->get('id'));
$db->setQuery($query);
return $db->loadResult();

Use the 'id' as key and 'label' as label. Set access on the element so they don't have add/edit. Then (hopefully) the label will show read-only as a simple div with text.

Then allow them edit access to elements_labels.

Of course you've then got the problem of stocking elements_labels with rows for all your users for all the elements ... which is possible, I do similar stuff with other "per user config" type stuff, but takes a little effort. Or have a set of defaults you use if there isnt a matching user_id && element_id in the lookup table.

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

Thank you.

Members online

Back
Top