Conditional fields and values

13 years 11 months ago #1440 by elesus
I think it is possible for the custom Tab... but I doubt if it is possible to include JS into the registration page...

СB3РD
13 years 11 months ago #1727 by beat
elesus wrote:

I think it is possible for the custom Tab... but I doubt if it is possible to include JS into the registration page...


Yes it is possible. Read carefully the API documentation ;).

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
13 years 11 months ago #1729 by elesus
So, do you mean that it is possible to implement conditional fields on the registration page using plugin with JS?

СB3РD
13 years 11 months ago #1730 by mikko
Do you suggest that this feature should be implemented as custom tab, or should it be postponed until the fields have been included in the plugin api?

We are in need of this feature in a month or two and will code it ourselves one way or another.

mikko
13 years 11 months ago #1748 by beat
elesus wrote:

So, do you mean that it is possible to implement conditional fields on the registration page using plugin with JS?


@ elesus:
Didn't say that like this... ;)
Just said that it is also possible to cleanly insert JS into the registration page... and to do whatever is needed for your plugin own dhtml handling.


mikko wrote:

Do you suggest that this feature should be implemented as custom tab, or should it be postponed until the fields have been included in the plugin api?

We are in need of this feature in a month or two and will code it ourselves one way or another.

mikko


@ Mikko,

Well, fields handling moving to plugins was planed, but didn't make it into RC2. I'm not expecting it to happen within the next 2 months on my free time, except if there is a business case for this and the other nice stuff expressed in this thread, as other stuff has higher priority on my short-term sparse free time. ;)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
13 years 11 months ago #1752 by mikko
Here is a draft plan for making a plugin to implement the functionality. This is definitely not an end user solution, but something to start with.

Add table conditions with columns id, field, value. When a given field has a given value, the condition is considered active.

Add column confition id to fields and field values. This indicates which condition must be true for field or column to show.

The plugin would insert javascript that would.

1) Initially evaluate all options and hide all fields and options that do not have a non null condition that evaluates to fals calling document.getElementByName()

2) Implement functions to toggle conditions on/off. This functions would hide or show options and fields

3) Iterate all elements with conditions enabled and insert stuff in the onchange property to to call the toggle functions whne conditions become true.

All the data would be managed directly in the database, so no need to spend time with coding backend.

Making it with this design would be just a few hours.

Any comments on this design?

mikko
Moderators: beatnantkrileon
Time to create page: 0.415 seconds
Facebook Twitter Google LinkedIn