Tagged: decimal, floating point, profile, xprofile
Hello,
I added a decimal field and set the step to 0.000001
Intended use is to capture Lat/Long at the city level. For example, Las Vegas would be 36.169941 and -115.139832 respectively.
When I enter those values and try to update my profile, the following error results: “There was a problem updating some of your profile information. Please try again.”
Not sure how to proceed from here.
Quint
Hi Quint,
Thank you for the question.I will not suggest using the number field for lat/long. You should either use the text field(even number is stored as text data due to xporofile table structure) or use teh BuddyPress Xprofile Geolocation plugin which is better suited for similar task.
Regards
BrajeshHello Brajesh,
Thanks for the recommendation. At the moment, GEO my WP is producing a fatal error when I attempt to activate the plugin. Hopefully, it’s compatible with BuddyBoss and the Geo my WP support staff can resolve. It’s in their court.
Anyway, I tried that decimal field with a step of .0001 since I need it for capturing performance ratings. It produces the same error. My preference is “number” since the validation rules would natively apply. However, if you know how I can add a filter to that/any Xprofile input field when a member attempts to submit the data, then that would work too since I could perform my own validation/etc.
Quint
Hi Quint,
Please take a look at the Advance Xprofile Field for marking the text field as numeric.
https://wordpress.org/plugins/advanced-xprofile-fields-for-buddypress/
Please let me know if it works.
Regards
BrajeshHello Brajesh,
That’s a valuable plugin. However, setting the field as numeric is not an option in the dropdown. Alphanumeric is and that won’t work when it will eventually be used in a faceted range search for members with a rating between x and y.
Unless I’m missing something….
Quint
Hi Quint,
Thank you for the feedback.BuddyPress lacks the proper way to provide feedback about a field. It is normally not on field level but on collection level on profile edit/registration pages.
I can help you with the validation with some code. What is the expected workflow if the user do not enter a valid value? Do we discard the value? Do we generate error which is shown at the top of the page?
Regards
BrajeshHello Brajesh,
Whatever you provide would be great. The validation step in BuddyBoss when editing the Profile, is after clicking the Save Changes button. If it fails, the error is noted at the top of the page and the field value is discarded.
So, in this case since you recommended a text input field to capture the Lat/Long, the validation would check that it is not alphanumeric but numeric (containing only numbers and a decimal point) instead. I’m using Lat/Long as an example.
Another example would be “performance rating” which would capture a floating point value to 4 decimal places which would then be used in a faceted search using a range facet, searching for members with a rating between x and y.
Hello Brajesh,
On a lark, I just tried using the Xprofile Fields – Decimal Field again. I specified a precision of 4 and step size of .0001. It worked!
Why? I think that the first time I tried it, I did not specify the precision, only the step size. So far, it fails if those are mismatched.
If you like, this topic can be “resolved.”
Quint
P.S. It may be helpful to add this info/direction for that field in the plugin’s FAQ.
Hi Quint,
Thank you for letting me know. I will look into it on Monday and assist further.Regards
Brajesh
You must be logged in to reply to this topic.