Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • General
  • Design & Templates
  •  
  • <
  • 1
  • 2
  • >
  • Populate a TV listbox with a list of resources#

  • 2206
    22

    arx707 Reply #1, 2 years, 6 months ago

    Reply
    • Link to this post#1
    Hi.

    I'm trying to create a simple CRM as exercise to learn Modx (revolution).
    I created two containers:

    - People
    - Companies

    And may documents for each category.


    When editing people, I'd like to have listbox populated with all the companies previously entered. Then i should select the company or companies associated with that person. I just need the names of the companies.

    I think I should use a TV with @EVAL, but currently but how can i do this?



  • 4310
    2,276
    Snippets : eForm 1.4.4.7 with SMTP & PMS's security fixes | PHC Results | EasyNewsletter from CSV

    Wiki Articles : Custom DB table to placeholders | Manager Locked Out?

    Websites : Work - U.K. based MODx development  |  Hobby - Free interactive education resources for teaching 4 - 11 year olds

    Hosting : One Smart Host - Professional MODx hosting 

    bunk58 Reply #2, 2 years, 6 months ago

    Reply
    • Link to this post#2
    Have a look at this thread.
    It should point you in the right direction


  • 4971
    964
    Website: www.mercologia.com
    MODX Revo Tutorials:  www.modxperience.com

    MODX Professional Partner

    charliez Reply #3, 2 years, 6 months ago

    Reply
    • Link to this post#3
    Yep, or @SELECT will do the trick, do a query to select the value
    that you want. I usually use the page title but you could use any
    other value of the People or Company page.


  • 2206
    22

    arx707 Reply #4, 2 years, 6 months ago

    Reply
    • Link to this post#4
    I took the code in the link and modified it changing che placeholder syntax and the parnt resource ID

    @SELECT pagetitle, id FROM ( (SELECT pagetitle, id, menuindex FROM site_content WHERE parent = 3) UNION (SELECT '@INHERIT', '@INHERIT', 9999) ORDER BY menuindex) as sc

    Then I created a new drop down list and put the code in the Input Option Value field

    Unfortunately the result is just a blank drop down menu.

    I also tried a simpler query: @SELECT pagetitle FROM site_content WHERE parent = 3

    With no results.

    Any suggestion?


  • 33337
    3,901
    - MODX Special Forces
    Share and explore websites made in MODx by Zaigham's Web | Tweet @zaigham | Resource Center


    MODx Current | MODx on Git! | BUGS! | RTFM (Read the Fully awesome Manuals)

    Zaigham (aka zi) Reply #5, 2 years, 6 months ago

    Reply
    • Link to this post#5
    i think PREFIX is something else. Cant recall now though :/


  • 4310
    2,276
    Snippets : eForm 1.4.4.7 with SMTP & PMS's security fixes | PHC Results | EasyNewsletter from CSV

    Wiki Articles : Custom DB table to placeholders | Manager Locked Out?

    Websites : Work - U.K. based MODx development  |  Hobby - Free interactive education resources for teaching 4 - 11 year olds

    Hosting : One Smart Host - Professional MODx hosting 

    bunk58 Reply #6, 2 years, 6 months ago

    Reply
    • Link to this post#6
    @SELECT pagetitle FROM modx_site_content WHERE parent = 3


  • 2206
    22

    arx707 Reply #7, 2 years, 6 months ago

    Reply
    • Link to this post#7
    @bunk58

    Thank you for the code.

    Unfortunalely it doesn'y work at all - the dropdown list is empty

    Is it possiblle that @select populates dropdown lists only in evolution? (i'm using revolution)


  • 4310
    2,276
    Snippets : eForm 1.4.4.7 with SMTP & PMS's security fixes | PHC Results | EasyNewsletter from CSV

    Wiki Articles : Custom DB table to placeholders | Manager Locked Out?

    Websites : Work - U.K. based MODx development  |  Hobby - Free interactive education resources for teaching 4 - 11 year olds

    Hosting : One Smart Host - Professional MODx hosting 

    bunk58 Reply #8, 2 years, 6 months ago

    Reply
    • Link to this post#8
    It was for Evolution.
    Personally, I think we're going to need the forum splitting into two areas.
    Otherwise there's likely to be a lot of time and effort wasted


  • 2206
    22

    arx707 Reply #9, 2 years, 6 months ago

    Reply
    • Link to this post#9
    Quote from: bunk58 at Nov 10, 2009, 07:40 AM
    It was for Evolution.
    Personally, I think we're going to need the forum splitting into two areas.
    Otherwise there's likely to be a lot of time and effort wasted

    Totally agree. Since revolution is getting more popular finding information could be very difficult


  • 20364
    89

    mr.johnny Reply #10, 2 years, 6 months ago

    Reply
    • Link to this post#10
    Any idea how the statement would look for Revolution?

    @SELECT pagetitle FROM modx_site_content WHERE parent = 3

    Edit:

    When looking at the Revo database. There is still a 'modx_site_content' table with the fields 'pagetitle' and 'parent' ... should still work?

    Edit 2:

    Made a touch of progress. When I use this:

    @SELECT pagetitle FROM modx_site_content WHERE parent = 3

    It outputs this:


    It is PROPERLY grabbing 2 <options> because that is how many elements there are under that parent. When I add an element, it grabs 3.

    So, the challenge I am facing now is how to get it to grab the proper data and populate the <option> tags right.


  • <
  • 1
  • 2
  • >



Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
arx707, bunk58, charliez, mr.johnny, zaigham

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Careers at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy