Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Question on building dependant dd for registration

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
14 years 2 months ago #142912 by sfraise
It seems that the only way to really do the cities is to create a separate field for each state and province. Dumping 38,000 values into a single city field causes memory allocation errors and it's just a huge mess.

How I'm doing this is creating a field for each state/province, dumping the values into the field, then setting the dependency in the html to show the corresponding city drop down according to which state/province is selected. It seems to work this way ok but there are some draw backs.

The first draw back is the shear time it's taking to build this thing, I've just pulled an all-nighter and I'm only 25% done. The second draw back is I can't set the state/province field as required as the state and province and city are all completely different fields. The third draw back is I have to set the profiles to not display blank fields as it would show a line for state, a line for province, and a line for every single state and provinces cities. The fourth and most concerning drawback is how this will affect the list search, I'm going to have to do some jerry rigging on the search function to show the corresponding dependent drop downs to force the search to look at the correct fields and not show ALL of the fields. I'm not even trying to think about that part yet.

I know you guys are thinking about adding an integrated conditional dependency field function in cb 2.0 and I would say it actually should have been part of cb from the start, but have you guys done any work on this for the new version yet?

I also ran into a non cb issue last night while building this that really has me ticked off. It seems once your html code gets too long the joomla html source editor will simply cut your code off at that point when you hit save. I've had to move over to finishing the build in a regular html file until I can figure out how to get the full code into the blank module without using the stupid html editor or finding a way to get the editor to not cut it off. I can't find anything in the editor params to fix this, I've turned off auto clean up code, I've even tried the jce editor and it still cuts it off. Anyone here ever run into this issue and found a work around on it? I've done some searching on the joomla forum and on Google but haven't been able to find anything on it. I don't know if this is a bug or if Joomla designed this on purpose.

This stupid registration form is setting me back by at least a week and really making me look bad. I just kind of assumed someone else would have a cities drop down solution built that I could just plug in and go with it like there is a countries txt file you can just dump and go already built. I had hoped to be finishing up the custom profile template by now instead of grinding away on this mind numbing tedious cantankerous registration form. Not to mention I haven't even gotten to trying to get the cb captcha plugin to work with it yet lol.

For anyone that wants to look at the form it's currently at www.oohya.net/sandbox/oohya/registration.html since I can't get the html editor to take all of the code to put it in the light box module.

Post edited by: sfraise, at: 2010/09/29 13:29

Please Log in or Create an account to join the conversation.

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
14 years 2 months ago #143205 by sfraise
Ok, just about done with the registration form it's self, with all data uploaded. Still can't figure out how to get the html source editor to take all of the code though.

I'm now on to figuring out a way to add the conditional dependency function to the edit profile section so it doesn't show each and every city field.

I see the function userEdit( $option, $uid, $submitvalue, $regErrorMSG = null ) {
global $_CB_framework, $_POST, $_PLUGINS;
section of the comprofiler.php file but I'm not exactly sure how to tackle the problem. I have the js file loaded in the head of the index.php file so all I need to do now is somehow add the DEPENDS ON field BEING value string to where the field options are called. Problem is I'm not exactly sure where that's at. I'm guessing in the cb.core file which I'm pouring over now.

Post edited by: sfraise, at: 2010/10/01 00:33

Please Log in or Create an account to join the conversation.

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
14 years 2 months ago #143259 by sfraise
Ok, after looking through the cb.core file I have a basic idea, please someone let me know if I'm on the right track or not on this.

I think the area I need to add the conditional functionality to is this here:
[code:1]
function getFieldRow( &$field, &$user, $output, $formatting, $reason, $list_compare_types ) {
global $ueConfig, $_CB_OneTwoRowsStyleToggle;

$results = null;

if ( $output == 'htmledit' ) {

if ( ( $field->name != 'password' ) || ( $reason != 'register' ) || ! ( isset( $ueConfig ) && ( $ueConfig == "1" ) ) ) {

$verifyField = new moscomprofilerFields( $field->_db );
foreach ( array_keys( get_object_vars( $verifyField ) ) as $k ) {
$verifyField->$k = $field->$k;
}
$verifyField->name = $field->name . '__verify';
$verifyField->fieldid = $field->fieldid . '__verify';
if ( $field->name == 'password' ) {
$verifyField->title = _UE_VPASS;
} else {
$verifyField->title = sprintf( getLangDefinition( $field->params->get( 'verifyPassTitle', '_UE_VERIFY_SOMETHING' ) ), getLangDefinition( $field->title ) ); // cbReplaceVars to be done only once later
}
$verifyField->_identicalTo = $field->name;

$toggleState = $_CB_OneTwoRowsStyleToggle;
$results = parent::getFieldRow( $field, $user, $output, $formatting, $reason, $list_compare_types );
$_CB_OneTwoRowsStyleToggle = $toggleState; // appear as in same row
$results .= parent::getFieldRow( $verifyField, $user, $output, $formatting, $reason, $list_compare_types );

unset( $verifyField );

} else {
// case of "sending password by email" at registration time for main password field:
$results = parent::getFieldRow( $field, $user, $output, $formatting, $reason, $list_compare_types );
}
} else {
$results = parent::getFieldRow( $field, $user, $output, $formatting, $reason, $list_compare_types );
}
return $results;
}
[/code:1]
I'm still not exactly sure how to actually add the AND DEPENDS ON ($field) BEING ($value) to the class=inputbox output when the form gets rendered though. I was thinking of something along the lines of adding an additional column to the fields table labeled $fielddep and setting 0 for no dependency and 1 for dependency, then setting the backend up where you can specify if the field is dependent or not and what field and value it depends on and label those values $depfield & $depvalue. I think I'm on the right track there, however actually building the code to add the dependency statement to the inputbox class is where I'm stuck. Or maybe I'm going about it entirely the wrong way, maybe I need to simply specify somehow if $fielddep == '1' and $depfield, $depvalue == 'selected'
$results;
else
but then this line of thought I can't think of a good wat to activate the js to hide/show the dependent field unless I'm able to set it to hide a div or something.

I dunno.

Please Log in or Create an account to join the conversation.

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
14 years 2 months ago #143260 by sfraise
Ok, after looking through the cb.core file I have a basic idea, please someone let me know if I'm on the right track or not on this.

I think the area I need to add the conditional functionality to is this here:
[code:1]
function getFieldRow( &$field, &$user, $output, $formatting, $reason, $list_compare_types ) {
global $ueConfig, $_CB_OneTwoRowsStyleToggle;

$results = null;

if ( $output == 'htmledit' ) {

if ( ( $field->name != 'password' ) || ( $reason != 'register' ) || ! ( isset( $ueConfig ) && ( $ueConfig == "1" ) ) ) {

$verifyField = new moscomprofilerFields( $field->_db );
foreach ( array_keys( get_object_vars( $verifyField ) ) as $k ) {
$verifyField->$k = $field->$k;
}
$verifyField->name = $field->name . '__verify';
$verifyField->fieldid = $field->fieldid . '__verify';
if ( $field->name == 'password' ) {
$verifyField->title = _UE_VPASS;
} else {
$verifyField->title = sprintf( getLangDefinition( $field->params->get( 'verifyPassTitle', '_UE_VERIFY_SOMETHING' ) ), getLangDefinition( $field->title ) ); // cbReplaceVars to be done only once later
}
$verifyField->_identicalTo = $field->name;

$toggleState = $_CB_OneTwoRowsStyleToggle;
$results = parent::getFieldRow( $field, $user, $output, $formatting, $reason, $list_compare_types );
$_CB_OneTwoRowsStyleToggle = $toggleState; // appear as in same row
$results .= parent::getFieldRow( $verifyField, $user, $output, $formatting, $reason, $list_compare_types );

unset( $verifyField );

} else {
// case of "sending password by email" at registration time for main password field:
$results = parent::getFieldRow( $field, $user, $output, $formatting, $reason, $list_compare_types );
}
} else {
$results = parent::getFieldRow( $field, $user, $output, $formatting, $reason, $list_compare_types );
}
return $results;
}
[/code:1]
I'm still not exactly sure how to actually add the AND DEPENDS ON ($field) BEING ($value) to the class=inputbox output when the form gets rendered though. I was thinking of something along the lines of adding an additional column to the fields table labeled $fielddep and setting 0 for no dependency and 1 for dependency, then setting the backend up where you can specify if the field is dependent or not and what field and value it depends on and label those values $depfield & $depvalue. I think I'm on the right track there, however actually building the code to add the dependency statement to the inputbox class is where I'm stuck. Or maybe I'm going about it entirely the wrong way, maybe I need to simply specify somehow if $fielddep == '1' and $depfield, $depvalue == 'selected'
$results;
else
but then this line of thought I can't think of a good wat to activate the js to hide/show the dependent field unless I'm able to set it to hide a div or something.

I dunno.

Please Log in or Create an account to join the conversation.

  • bluebox
  • bluebox
  • OFFLINE
  • Posts: 9
  • Thanks: 0
  • Karma: 0
14 years 1 month ago #144845 by bluebox
I seriously wish I knew how to program, this conditional field feature is needed so badly right now in CB. It would be nice if the CB team had the plugin available but they keep saying this feature won't be added until version 2.0 which has no official release date. I'm even willing to pay for this man if you can get it to work bug free. I need this for students and employers registering on my site.

Please if anyone understands how to do this, can you give this fellow a hand? Many of us have been asking for this for the past couple of years:)

Please Log in or Create an account to join the conversation.

  • 88al88
  • 88al88
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
14 years 4 weeks ago #147084 by 88al88
Did you ever get this to work? I'm working on something similar now. Not having much like. Though I got it to work in the Advanced Search.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum