duploX
Posts: 14
|
| Posted: 11/13/2007, 5:57 PM |
|
I need to create an Online Computer Configurator. Here are my questions:
a) Is it possible, when you click on a listbox, to display more than just one value per line,
e.g.
Monitor | 19 Inch | Samsung | CAD | 299,99
Monitor | 22 Inch | Samsung | CAD | 399,99
b) If YES, is there a way to FORMAT the listboxes,
e.g.
Monitor | 19 Inch | Samsung | CAD | 299,99
Monitor | 32 Inch | Hitachi | CAD | 1.299,00
Monitor | 32 Inch | Sony | CAD | 799,00
Please HELP. Thank you.
Christoph
|
 |
 |
wkempees
|
| Posted: 11/13/2007, 7:37 PM |
|
It is as simple as 1,2,3.
Create your listbox as you normaly would.
Then in the Listbox's Properties Datasource press [...] to go to it's VQB
(visual Query Builder.
You would normaly see two values being selected (assume:) id,text
These two fields will show up in the lower right pane, when you set the
cursor on the SELECT.
Take good notice of the current name of the second field 'text' in my
example.
where it says 'text' (left column of lower right pane) type (in MySQL):
concat_ws(' | ', field1, field2, field3, field4)
then type 'text' in the ALIAS (right column of lower right pane)
If you make sure the alias = the original, this should be it.
(MsSQL I think): field1 & ' | ' & field2 & ' | ' & field3 & &' | '& field4
If you want it to be properly aligned you would have to experiment with
either
html or div's. This I have not at hand at this moment.
Let us know.....
Walter
|
|
|
 |
duploX
Posts: 14
|
| Posted: 11/13/2007, 8:46 PM |
|
I work with SQL server and (MsSQL I think): field1 & ' | ' & field2 & ' | ' & field3 & &' | '& field4
does NOT work.
Care to help me ????
Thank you.
Christoph
|
 |
 |
wkempees
|
| Posted: 11/14/2007, 4:19 AM |
|
Sorry for being incomplete.
GOOGLE: MsSQL concatenate
field1 . ' | ' . field2 . ' | ' . field3 . ' | ' . field4
Walter
|
|
|
 |
duploX
Posts: 14
|
| Posted: 11/14/2007, 5:27 AM |
|
You are the best, Walter !!!
The solution was to separate the fields with a simple + . Sometimes the easiest solutions are the furthest away. LOL.
Any idea how to align the content in the listbox ???
Christoph
|
 |
 |
wkempees
|
| Posted: 11/14/2007, 6:19 AM |
|
No time to test this, but:
one approach is to google your SQL formatting options.
making each separate field a fixed leght and type and then concatenate them.
Walter
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 11/14/2007, 6:31 AM |
|
What I meant is:
Decide upon the max length of each field and format them to that length before concatenating them.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
duploX
Posts: 14
|
| Posted: 11/15/2007, 7:56 PM |
|
Hi Walter
I am still working on the formatting part, everything else works fine. THANK YOU.
I have another question though.
Is it possible to Update another field with a value from the Listbox ????
e.g. Listbox has the values Products And Price
I want to take the Price value and Update another field in the form with this value.
Please Help !
Christoph
|
 |
 |
JoshDunigan
Posts: 1
|
| Posted: 03/05/2008, 12:34 PM |
|
I don't know how you could do this inside code charge, but below is some sample asp that can do this. Perhaps you can add this code in once you publish your project.
function addOption(whichDD,name,value)
{
// create a reference to the SELECT and the form
var theDD=eval(whichDD);
// create the new OPTION
var newOption;
newOption= new Option (name,value);
// position
var insertAt = theDD.options.length;
// create the space
theDD.options.length=theDD.options.length + 1;
// add the option
theDD.options[insertAt] = newOption;
}
function populateDD()
{
// read the first dropdown value
var firstDD=document.thisForm.first_dropdown.value;
//reset the second dropdown
document.thisForm.second_dropdown.length=0;
// Populate the second DD
switch (firstDD)
{
case 'Value1 from first dropdown':
addOption('document.thisForm.second_dropdown','name of the dropdown variable','value of the dropdown');
case 'Value 2 from first dropdown':
addOption('document.thisForm.second_dropdown','name','value');
break;
}
}
Include the above area in the <script> tag
At the <select> tag for your first dropdown add ONCHANGE="populateDD():"
At the second dropdown, just simply have <select name="second_dropdown"></select>
Of course with all sample code be sure to replace any of the first_dropdown / second_dropdown variables with those of your select names.
Hope this helps, feel free to contact me for a full sample working page.
|
 |
 |
|