|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#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?) |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
RE: New Drop Down Menu Issue
We have a question in our FAQ that relates to this problem your having
http://codewalkers.com/faq/12/33.html |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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.
|
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
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! |
|
#9
|
|||
|
|||
|
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 --- |
|
#10
|
|||
|
|||
|
RE: New Drop Down Menu Issue
That should have read Lines 66 for the first error and Line 7 for the second one.
|
|
#11
|
||||
|
||||
|
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.
|
|
#12
|
|||
|
|||
|
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. |
|
#13
|
||||
|
||||
|
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. |
|
#14
|
|||
|
|||
|
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.
|
|
#15
|
|||
|
|||
|
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? |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > New Drop Down Menu Issue |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|