fields filling each other

5 years 8 months ago - 5 years 8 months ago #306992 by tigersloft
fields filling each other was created by tigersloft
I have a need for two fields (tname) and (tnum). the two are related in that tname will contain a dropdown list of group names. tnum will contain a dropdown list of group numbers. each unique name will match a number. i would like to be able to use the dropdown to select either a name or a number and have the other field populate accordingly. any suggestions on how to do this?

on a side note, i have a dropdown created now with the names/numbers as one value but can't seem to "search" by the number. only the letters. so, i think the above will give me a better overall solution. I've attached a screen shot. if either field is changed, the other is changed based on the selected option.

Attachments:

Please Log in to join the conversation.

5 years 8 months ago #307002 by krileon
Replied by krileon on topic fields filling each other
Sounds like you need to use CB Query Field or CB Code Field. Then use a Query Select or Code Select fieldtype. Which you use depends on if you need to use PHP (CB Code Field) to output the select options or SQL (CB Query Field). This will allow you to have their query or code account for the value of the other field by substituting them in with [FIELD_NAME] and using them accordingly in your PHP or SQL.

The problem comes with updating tname when tnum changes and updating tnum when tname. That's basically an infinite loop. You can update tname based off the value of tnum using CB Core Fields Ajax and its Update On (see Integrations > CB Core Fields Ajax) functionality, but you won't be able to update bother of them like what you're wanting as they'll get stuck in a loop.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.311 seconds

Facebook Twitter LinkedIn