fields filling each other

3 weeks 6 days ago - 3 weeks 6 days ago #306992 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:
3 weeks 5 days ago #307002 by krileon
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 - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
Moderators: beatnantkrileon
Time to create page: 0.395 seconds
Facebook Twitter Google LinkedIn