Default value on Drop Down field

18 years 1 month ago #7896 by T.T.
Replied by T.T. on topic Re:Default value on Drop Down field
After a little hacking, I solved the problem for the registration-page. If the problem shows up somewhere else, just edit the code in the same way.

It turns out that the suggestion to change the default-field in the database to mediumtext is only part of the solution.

Here is the full explanation (you need to edit CBuilder's PHP):

1. first change the default field in the jos_comprofiler_fields-table from tinyint to mediumtext

2. edit < base > components com_comprofiler comprofiler.php

3. look up function registerForm() and find:

$rowFieldValues->name] =


4. the last argument should not be $k, but a reference to the default field:

$rowFields[$i]->default


That's all. Now my registration page shows a default value if i set it in the database B)

You could make it more complicated by referring to a dabase-field whose value you want to use, but i can't be bothered at this time. The developers can make this simple enough (just a radio button behind the values in the backend or checkboxes and if selected, then put the value of the referring field as selected). Why doesnt this exist in the first place?

Post edited by: T.T., at: 2006/03/08 08:44

Please Log in to join the conversation.

18 years 1 month ago #8119 by beat
Replied by beat on topic Re:Default value on Drop Down field
T.T.,

Thanks for pointing at this problem and providing a fix proposal 8) . Really appreciated :)

A very similar fix a few lines above (which has advantage to also work for server-side rejected registration forms by returning the user-selected values instead of always default ones) has been integrated into upcomming CB 1.0 stable. :)

Best Regards,

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

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.248 seconds

Facebook Twitter LinkedIn