Topic: Populate a TV listbox with a list of resources  (Read 1442 times)

Pages: [1]   Go Down

#1: 8-Nov-2009, 05:33 PM

arx707
Posts: 22

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?

#2: 9-Nov-2009, 03:17 AM


bunk58
Posts: 1,803

David Bunker

WWW
Have a look at this thread.
It should point you in the right direction

#3: 9-Nov-2009, 10:38 AM


charliez
Posts: 554

WWW
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.
Website: www.mercologia.com 
Blog (in Espaņol): Digital Stickiness www.mercologia.com/blog

#4: 9-Nov-2009, 12:27 PM

arx707
Posts: 22

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 [[+PREFIX]]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 [[+PREFIX]]site_content WHERE parent = 3

With no results.

Any suggestion? Huh
« Last Edit: 9-Nov-2009, 12:30 PM by arx707 »

#5: 9-Nov-2009, 02:13 PM

Administrator

zi
MODx Special Forces /
Posts: 3,555

May Peace Be On You

WWW
i think PREFIX is something else. Cant recall now though :/

#6: 9-Nov-2009, 02:20 PM


bunk58
Posts: 1,803

David Bunker

WWW
Code:
@SELECT pagetitle FROM modx_site_content WHERE parent = 3

#7: 10-Nov-2009, 07:36 AM

arx707
Posts: 22

@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)

#8: 10-Nov-2009, 07:40 AM


bunk58
Posts: 1,803

David Bunker

WWW
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  Sad

#9: 10-Nov-2009, 11:31 AM

arx707
Posts: 22

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  Sad

Totally agree. Since revolution is getting more popular finding information could be very difficult
« Last Edit: 10-Nov-2009, 03:29 PM by arx707 »

#10: 11-Nov-2009, 04:03 PM

mr.johnny
Posts: 39

Any idea how the statement would look for Revolution?

Quote
@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:

Quote
@SELECT pagetitle FROM modx_site_content WHERE parent = 3

It outputs this:

Quote
<select id="tv9" style="width: 300px;" size="8" onchange="MODx.fireResourceFormChange();" multiple="multiple" name="tv9[]">
<option selected="selected" value=""/>
<option selected="selected" value=""/>
</select>

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.
« Last Edit: 11-Nov-2009, 04:41 PM by mr.johnny »

#11: 13-Nov-2009, 02:59 PM

mr.johnny
Posts: 39

Bump! Anyone have any insight on this?

#12: 11-Dec-2009, 04:07 PM

mr.johnny
Posts: 39

And another bump ... anyone have any insight here?
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.