Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 4th, 2004, 11:58 AM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
New Drop Down Menu Issue

I have searched and searched for the best way to incorporate a dynamic drop down menu system for use with a php/mysql web application and ultimately using javascript seems the best approach.

The demo script available at:

http://www.ashleyit.com/rs/jsrs/select/php/select.php

provides a great solution to the issue, however, it includes 3 fields and I only need 2. I have tried and tried to eliminate the third field but not being very javascript savvy I have either ended up killing the script all together or error messages popping up on the screen. I am sure it can't be that difficult and most likely someone has either removed or added the number of drop downs in this example before. I would really appreciate any help the javascript gurus on this forum can offer.

Thanks again.

Reply With Quote
  #2  
Old February 4th, 2004, 02:51 PM
brewthatistrue brewthatistrue is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: CA, USA
Posts: 277 brewthatistrue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 sec
Reputation Power: 2
RE: New Drop Down Menu Issue

this is the js you want help with?
http://www.ashleyit.com/rs/jsrs/select/php/selectphp.js

whoa, i like that.
i whipped something similar up myself, but i did a javascript redirect to php self attaching a http GET parameter
e.g. if it were your page and i selected Chevrolet, it would redirect to
http://www.ashleyit.com/rs/jsrs/select/php/select.php?make=Chevrolet

this is better.
where can i get the javascript? (where'd you get it?)

Reply With Quote
  #3  
Old February 4th, 2004, 03:01 PM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

I got the original demo code from this site:

http://www.ashleyit.com/rs/jsrs/select/php/select.php

There are some other examples their also that might be of interest to you.

Thanks for the .js file but it is exactly the same as the one I am using and unfortunately I have been unsuccessful in editing this code to restrict the number of drop-down boxes to only two.

Any ideas?

Reply With Quote
  #4  
Old February 4th, 2004, 03:02 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: New Drop Down Menu Issue

We have a question in our FAQ that relates to this problem your havinguses that exact page as an example too)

http://codewalkers.com/faq/12/33.html

Reply With Quote
  #5  
Old February 4th, 2004, 03:09 PM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

Thanks but I am using the most recent version of this script and the bug has been corrected.

My real reason for posting is to find out how to adjust the number of drop-downs that are displayed. The default is 3 but I only want 2 and no matter what I have tried it dies on me.

Any help appreciated.

Reply With Quote
  #6  
Old February 4th, 2004, 03:51 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: New Drop Down Menu Issue

you mean you get a javascript error? Or what, please explain "dies". We can probably figure it out if you give us some specifics. I just edited the two javascript files, and bucked the table down to two fields. Seems to be ok for me.

Reply With Quote
  #7  
Old February 4th, 2004, 04:39 PM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

I am not familiar with javascript so if I just comment out the selectbox element for Options (the 3rd drop-down) within select.php I get the following error on the screen after the page loads and selection fields simply return ------Not Yet Loaded -----:

Line: 101
Error: 'options' is null or not an object

If I do something similiar in the jsrsClient.js (bearing in mind I don't understand javascript) I get either the same or the page does not display at all (it dies).

What did you change and in what files to get it to simply present 2 drop-downs?

Thanks.

Reply With Quote
  #8  
Old February 4th, 2004, 06:23 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: New Drop Down Menu Issue

Yeah, you have to take the javascript and PHP components out for the third table if you want to just use the two. I had it fixed, then erased it (usually do when I get someones problem working. So, I tried to redo what I did. I rezipped the file, and uploaded it here:

http://www.kg4vpv.com/download/Select.zip

Basically, I took the references to the option functions out from the make and model functions, and took it out of the PHP to be displayed too. Give it a whirl, I hope it works.
If you have an issue with it, just let us know!


Reply With Quote
  #9  
Old February 4th, 2004, 07:40 PM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

I tried the code you supplied and unfortunately I got 2 errors back from the browser, first:

Line: 6
Error: Syntax error

and second:

Line: 7
Error: Object expected

It looks close to working but errors out above and then the drop downs simply state --- Not Yet Loaded ---

Reply With Quote
  #10  
Old February 4th, 2004, 07:40 PM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

That should have read Lines 66 for the first error and Line 7 for the second one.

Reply With Quote
  #11  
Old February 4th, 2004, 10:57 PM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 26 sec
Reputation Power: 2
RE: New Drop Down Menu Issue

Can you give me more info on the "object expected" error. I need the exact error text. I had a similar error - Matt fixed it for me. If it's the same error then I'll give you the code.

Reply With Quote
  #12  
Old February 5th, 2004, 11:02 AM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

Sure, the exact errors that are displayed on screen are:

A Runtime Error has occurred.
Do you wish to Debug?
Line: 66
Error: Syntax Error

A Runtime Error has occurred.
Do you wish to Debug?
Line: 7
Error: object expected

In case it matters I am running this using apache on Windows XP Pro. No other references are made for the above errors in any of the logs for either the operating system or the apache web server.

Any help you can offer greatly appreciated.

Thanks.

Reply With Quote
  #13  
Old February 5th, 2004, 11:02 PM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 26 sec
Reputation Power: 2
RE: New Drop Down Menu Issue

Sounds familiar.
I had a problem like this one - don't know what lines you are refering too so can't say for sure that it's the same problem.
Matt provided a solution for me - he basically rewrote the Javascript so it referenced the form in a different way. I had to change my _onChange functions to contain this code:

Code:
function state_id_onChange(){
var val = document.QForm.state_id.options[document.QForm.state_id.selectedIndex].value;
if(val == noValue){
selectOption( document.QForm.state_id, curOption[document.QForm.state_id] )
} else {
curOption[document.QForm.state_id] = val;
emptyList( 'area_id');
emptyList( 'city_id');
window.status = 'Loading Area Selections...';
jsrsExecute( 'select_rs.php', cbFillCity, 'cityList', val);
} 
}


I hope this helps.

Reply With Quote
  #14  
Old February 6th, 2004, 08:38 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: New Drop Down Menu Issue

Just remember, since your using 2 menus instead of three, you wont have that second emptylist call in that function I dont believe.

Reply With Quote
  #15  
Old February 12th, 2004, 11:27 AM
poscribes poscribes is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Titusville, FL, USA
Posts: 9 poscribes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: New Drop Down Menu Issue

OK, now if appears that I have another problem with the same script.

When I pass the data from the form to the database in a different table (same database) the data that is written is the ID # and not the selection that is made. Has anyone else had this problem and needed to change the way the drop down information is linked to the reference table so that the correct information can be saved elsewhere?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > New Drop Down Menu Issue


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump