This topic is locked
[SOLVED]

 Dropdown list with multiple fields

8/8/2008 1:17:47 PM
PHPRunner General questions
E
emsurban author

How to create a dropdown that contains multiple fields.
For example:
Please select...

Username | Name | Location

Username1 | Name1 | Location1

Username2 | Name2 | Location2
where

Username = username field

Name = name field

Location = location field
I know this is possible.. but i dont know how.. can please guide me...

T
thesofa 8/8/2008

Go to Visual editor page

Find the field that you want a multiple column drop down for, double click on the box that shows the field type, set up the droip down list box, but where it says Display field, Chose Custom Expression and put in an expression such as

Concat(Username, " ", Name, " ", Location) ,



That will put spaces between each field value, alter the bit between the quote marks to suit you

E
emsurban author 8/9/2008

Go to Visual editor page

Find the field that you want a multiple column drop down for, double click on the box that shows the field type, set up the droip down list box, but where it says Display field, Chose Custom Expression and put in an expression such as
That will put spaces between each field value, alter the bit between the quote marks to suit you


Thanks! that was quick and it works <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=31997&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

500438 8/9/2008

I tried that and it put's all of the field together so you have first name + last name. but I want a drop down list that has

plan_1

plan_2

plan_3

ect
and then in the view or list you have a drop down list that when you click on one plan it passes the info for each field to my iframe.
any ideas?

T
thesofa 8/9/2008

I thought you were having the weekend off, coming back on Monday?

500439 8/10/2008

caught me. I'm one of those sick individuals that just can't stay away from a project until I get it right. and you're still here too. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=32015&image=1&table=forumreplies' class='bbc_emoticon' alt=':lol:' />
I'm not really working... I don't have the program at home, I'm just setting up for Monday.

Ok so have a nice sunday.
Patti

T
thesofa 8/10/2008

You're hooked too aren't you?

500440 8/10/2008

Yea when you get something to work like you want there's that moment where you do the whoo hoo around the room it's a good feeling.

I wish the tech support on this program was a little better but I'm wading through and learning in the process.
any ideas on the drop down links to an iframe in view or list? concat isn't what I want. or at least when i did it it just made one long link instead of individual links.

Patti

T
thesofa 8/10/2008

I know nothing about iframe, sorry.

As for the support here, i have found them to be brilliant, BUT you must be fully descriptive in your question, i see so many questions along the lines of "Why does my page not work" and then a stroppy follow up like "Hello, I have waited 5 minutes for a reply", even tho it is Sunday and the support crew probably live in the USA so it is Silly'o'clock where they live!
The search function can help, but the art is learning to ask the right questions.

I am gradually building up a list of bookmarks for these pages that contain answers that have sorted problems for me.

Sorry I cannot help more.

B
bgcrmdaddy 8/11/2008

Are you trying to send information to iframe which will be displayed in a form or do you want it to be written to the page?

Generally what you are looking to do is in visual editor switch to HTML mode and insert

<select name="site" size=1 onChange="parent.passText(this.form.site.options[this.form.site.selectedIndex].value)

;">

{php} global $conn; $LookupSQL = "select ";

$LookupSQL .="distinct ";

$LookupSQL .= "`YourFieldName`";

$LookupSQL .= ",`YourFieldName`";

$LookupSQL .= " from `_YourTable` ";

$LookupSQL.="where "."UserID='".$_SESSION["OwnerID"]."'";

$LookupSQL.=" ORDER BY `_YourTable`.`YourFieldName`";

$rs=db_query($LookupSQL,$conn);

while($data=db_fetch_numarray($rs)){

foreach($data as $data1){ echo '<option value="'.htmlspecialchars($data[0]).'">'.htmlspecialchars($data[1]).'</option>'; } }

{/php}

</select>

<script> function passText(str) {

top.frames['YourFrameName'].document.YourFormName.YourFormField.value = str;

}

</script>

501325 8/14/2008

got it thanks

Patti

I
Isterklister 9/18/2008

Hello,

I get it to work with multiple fields in the dropdown list.

How can I get values from another table too?
Ex

Table Personal

. id

. name

. age

. country (int) -> Countrylist
Table Countrylist

. id

. country
I will have a dropdown list showing "name country". If I only print:

concat(name,' ',country)

it will show, ex "Pelle 46" (If the name is Pelle and country 46 in the country (pointing on Country list id 46).

I will have "Pelle Sweden" instead. How can I do that?
/Pelle

T
thesofa 9/18/2008

try

concat(name,' ',`Countrylist`.`country`)where `Personal`.`country` = `Countrylist`.`id`

J
Jane 9/18/2008

Hi,
unfortunately it's impossible to use fields from different tables in the lookup query.

K
kamil6x 10/3/2008

Pardon my Ignorance with phpRunner Javascript but this seems hard to find on the net top.frames['YourFrameName'].document.YourFormName.YourFormField., since it's coded by phprunner, so what are 'YourFrameName' and YorkFormName; searching through the code I don't see references to Frames being named by phpRunner and I usually just use:
document.getElementById("DropDown").options.add(opt);
But it's not compiling with Smarty.

?

Are you trying to send information to iframe which will be displayed in a form or do you want it to be written to the page?

Generally what you are looking to do is in visual editor switch to HTML mode and insert