Found a few bugs with profile fields in 7.0.8 (WRE 0.7.1):
I added a new profile field with type Yes/No, and in possible values I put Yes and No on each line (though this should've been default anyway), and under default value I put Yes.
Doing this caused an error in the webgui log everytime a user went to edit profile with the following error:
2006/12/06 08:59:15 - ERROR - webgui.formsys.com.conf - main::[[undef]] - Couldn't execute operation : WebGUI::Operation::Profile::www_editProfile. Root cause: Can't use string ("YesNo") as a HASH ref while "strict refs" in use at /data/WebGUI/lib/WebGUI/ProfileField.pm line 159.
Even changing the field type to a Checkbox after this didn't fix the problem.
So I deleted the profile field to clear the error and got:
2006/12/06 09:07:21 - ERROR - webgui.formsys.com.conf - main::[[undef]] - Couldn't execute operation : WebGUI::Operation::ProfileSettings::www_deleteProfileFieldConfirm. Root cause: Can't call method "isProtected" on an undefined value at /data/WebGUI/lib/WebGUI/Operation/ProfileSettings.pm line 117.
I re-added the profile field, this time copying what the 'Make profile public field' did - ie. no possible values, but instead of default 0, I used 1 thinking it'd put a Yes there.
Edit Profile worked this time, but default value for the new field was no when I tested it.
Deleted the profile field, and this time saw the help for default value said to use 'yes' or 'no' for Yes/No fields.
So I created the field once more (with a different field name just in case), and put 'yes' as the default - but it still comes up no in my profile.
I ended having to reword the question so that No was the default answer.
So.. I guess this is three bugs really..
-If my comment is useful, rate me - I can always use the karma! :)Join us on the #webgui irc channel on freenode! (I use the nick Radix)
Yes/No isn't supposed to accept possible values. Possible values are also not simply listed one-per-line; they're in the form of a Perl hash. See the default "Gender" field, for instance. The handling of invalid possible-values hashes has been made slightly more graceful since then (so that it doesn't crash like that) in 7.2.2.
As for the third default-value problem, I'll try to reproduce that locally.
There is not a bug in the code, but rather the Profiling system needs some documentation updates (which I will do for 7.3.0).Let's first discuss the Possible Values field. This field should only be used in with the following form fields:Checkbox ListCombo BoxHidden ListRadio ListSelect BoxSelect ListNone of the other profile fields should use the Possible Values field as they will be ignored. If you do enter a Possible Values list, it MUST be formatted as follows{ "key1"=>"value1", "key2"=>"value2", "key3"=>"value3" ...}Braces, quotes and all. You simply replace "key1"/"value1" with your own name/value pairs.If you do not format it in this fashion, the system will throw an error but should not crash out in 7.3.0. You are using an older version of WebGUI so the error you are seeing was probably fixed somewhere along the way.Second, let's address the Default Value field. This is not supposed to be used with anything other than the Possible Values field and it should directly reference one or more of your keys as follows:["key1","key2",...]Now let's discuss what you are trying to do and how to do it. You can either create your own Yes/No field using the Radio list where your Possible Values are:{ "yes"=>"Yes", "no"=>"No"}and your Default Value is:["yes"]or you can create the YesNo field and then set the Visitor's profile default to "yes" which will, by default automatically default the field to "yes" for all of new users (and also users that have not ever been saved with the new field - though it won't automatically set this for them: You'll have to edit/save each one individually).There is a bug here in the documentation which improperly tells you to use "Yes" to set the default field. I am going to update the documentation to reflect what I've said here. Hopefully this will clear things up.Closing this.