Jump to content

vchris

Members
  • Posts

    1,529
  • Joined

  • Last visited

Everything posted by vchris

  1. Well I am troubleshooting right now and when I only output i in my if statement I get 20 outputs which is correct but as soon as I add process.options = null and the i output there isn't 20 outputs. So I'm guessing it must be process.options = null.I'll try that thanks.EDIT:I get the same effect... hmmm...
  2. Great! Now it's working. Now I'll try and make it add back all the options onChange so they come back and I can just remove the ones that are not related to the option in select 1.EDIT:I guess I'll need to create a 2 dimensional array to store the values and description right?Seems like the script is working in removing some options but it doesn't seem like it's removing the right ones.For some reason when I select the last option (value = 60) I still have options in the 2nd select but there is not options in that select with the value of 60.I changed the code a bit but the same functionality is there like before. for(i = 0; i < process.options.length; i++) { if(selectbox.options[selectbox.selectedIndex].value != process.options[i].value && process.options[i].value != 'default' && selectbox.options[selectbox.selectedIndex].value != 'default') { process.options[i] = null; } } Here's the data I have: Select 1:20 - Coincidental Manufacture30 - Combustion50 - Electroplating60 - Solid Waste Disposal40 - Spray Application or Organic Coatings10 - Wastewater Treatment------------------------Select 2:1050 - 30 - Anthracite Coal Combustion1110 - 30 - Bagasse Combustion in Sugar Mills1040 - 30 - Bituminous and Subbituminous Coal Combustion1060 - 30 - Fuel Oil Combustion1020 - 30 - Gasoline & Diesel Engines1010 - 30 - Heavy Duty Natural Gas1030 - 30 - Large Stationary Diesel1100 - 30 - Lignite Combustion1080 - 30 - Liquified Petroleum Gas Combustion1070 - 30 - Natural Gas Combustion1170 - 20 - Petroleum Refining1120 - 30 - Residential Fireplaces1130 - 30 - Residential Wood Stoves1000 - 30 - Stationary Gas Turbines1140 - 30 - Waste Oil Combustion1150 - 20 - Welding1180 - 20 - Wet Cooling Tower1160 - 20 - Wood preservation1090 - 30 - Wood Residue Combustion in Boilers Basically the # 20, 30 is what I am comparing. I outputted i and it only went up to 9. I found out that the length of my select was going down so it only did half of it. Now I have declared a variable before my loop it the value doesn't go down anymore. Still I have a problem. For instance if you choose value 60 in the first select, there should not be any option in the second select since no value is 60 but there are some options in the 2nd select. I don't understand this...Are you sure this process.options = null; is correct?
  3. JS: function removeOptions(selectbox){ var i; process = document.getElementById('process'); for(i = 0; i < process.options.length; i++) { if(selectbox.options[selectbox.selectedIndex].value == process.options[i].value) { process.options[i] = null; } }} HTML: <div id="processGroupContainer"> <p><label>Process Group <span class="star">*</span></label> <select name="processGroup" id="processGroup" onChange="removeOptions(this.value);"> <option value="default">Make a Selection</option> <cfoutput query="getProcessGroup"> <option value="#getProcessGroup.ProcessGroup_Code#">#getProcessGroup.Description_E#</option> </cfoutput> </select></p> </div> <div id="processContainer"> <p><label>Process <span class="star">*</span> <span class="small"><a href="/pdbis/oecd/oecd/admin/addproc.cfm" target="_blank" id="addProcessLink">Add Process</a></span></label> <select name="process" id="process"> <option value="default">Make a Selection</option> <cfoutput query="getProcess"> <option value="#getProcess.ProcessGroup_Code#">#getProcess.Description_E#</option> </cfoutput> </select></p> </div> This form is very long and I don't think you'll need everything. This should be enough.
  4. I get an error: "selectbox.selectedIndex has no properties".my code process = document.getElementById('process');for(i = 0; i < process.options.length; i++) { if(selectbox.options[selectbox.selectedIndex].value == process.options[i].value) { process.options[i] = null; } }
  5. Sorry maybe I didn't precise. I want to remove on the options with a different value than the first select.Here's what I got: var i; process = document.getElementById('process'); document.write(process.options.length); for(i = 0; i < process.options.length; i++) { if(selectbox.options.selected.value == process.options[i].value) { process.remove(i); } } This should only remove certain options but somehow it says selectbox.options does not have any properties.
  6. I'm not sure I understand what you mean... You want a text background?
  7. I haven't heard of entry conditions for the certification. I say if you can do the quiz and have some xhtml/css experience. Do It!
  8. I filled the options in a select with an sql query. What I need to do now is to remove some of the options depending on the choice of the 1st select. This 2nd select options depends on the 1st select. How can I remove some options in a select with JS?
  9. How would I do your D option in your second post?I know I can get all the records for that drop down but how can I only choose the ones needed with javascript?
  10. it's only compatible with IE and FF!!! oh really? I didn't know that. Tell me what options do I have when I want to change the options in a select depending on the selected option in another select? I don't want any page reload.
  11. vchris

    Anyone know AJAX

    hmmm... I'll show you what I got. First what I wanna do is when the user chooses an option in select 1, the select 2 choices should be changed depending on the choice in select 1. Select 2 gets it's choices from a sql query. <script language="javascript">function getOptions(parentId){ /* This executes the CF function GetMenu(parentId) and executes the JS function showNewOptions(result) when it returns. It's Asynchronous, so getOptions() doesn't wait for anything. */ DWREngine._execute(_cfscriptLocation_Assignments, null, 'GetMenu', parentId, showNewOptions);}function showNewOptions(result){ /* result is the CFAJAX return from the query. In this case we get a CF query that's been turned into a JS Array of Objects. */ //first, clear out the existing options var mySelect = document.getElementById('process'); mySelect.options.length = 0; //now populate the new options for (var i=0; i < result.length; i++ ) { mySelect.options[i] = new Option(result[i].OPTIONTEXT,result[i].OPTIONVALUE); }}</script><!--- CF function to populate process list ---> <cffunction name="GetMenu" output="false" returntype="query" hint="Returns a query of the submenu items based on the parent menu ID"> <cfargument name="ParentID" required="yes" type="numeric" hint="The parent ID of the items to return"> <cfset var QGetMenu=""> <cfquery datasource="xxxxx" name="QGetMenu"> SELECT * FROM Process WHERE ProcessGroup_code = <cfqueryparam cfsqltype="cf_sql_numeric" value="#ARGUMENTS.ParentID#"> </cfquery> <cfreturn QGetMenu> </cffunction> Select 1: <div id="processGroupContainer"> <p><label>Process Group <span class="star">*</span></label> <select name="processGroup" id="processGroup" onChange="getOptions(this.value);"> <option value="default">Make a Selection</option> <cfoutput query="getProcessGroup"> <option value="#getProcessGroup.ProcessGroup_Code#">#getProcessGroup.Description_E#</option> </cfoutput> </select></p> </div> Select 2: <div id="processContainer"> <p><label>Process <span class="star">*</span> <span class="small"><a href="/pdbis/oecd/oecd/admin/addproc.cfm" target="_blank" id="addProcessLink">Add Process</a></span></label> <select name="process" id="process"> </select></p> </div> All this is based on http://www.fusionauthority.com/Techniques/...ldFusion-Part-I
  12. Thanks a lot for even starting this project. You didn't have to do this.Nice work!
  13. vchris

    Anyone know AJAX

    That's no issue since I won't be redirecting. How do I include a library file for ajax? Can I simply link to the library file online?
  14. vchris

    Anyone know AJAX

    This.http://w3schools.invisionzone.com/index.ph...amp;#entry47184
  15. vchris

    CSS / EM & EX

    It means the default em size is 1em and I pretty sure it's equal to 12 pt. Try it yourself on a page. Create 1 paragraph in 1em and another in 12pt.never heard of ex.
  16. If you know AJAX and could give me a hand with something let me know!
  17. vchris

    AJAX Forum

    We need an AJAX forum.
  18. Check this out!http://www.microsoft.com/technet/sysintern...BlueScreen.mspxVery cool!
  19. Here's what I was looking for!http://www.indiankey.com/cfajax/examples/list.htmNow just need to understand it and make it work.EDIT:Even better http://www.fusionauthority.com/Techniques/...ldFusion-Part-IAnyone know what they mean by: I figured out that I need a library for ajax to work. I know Yahoo has a ajax library. Anyone know how to include and what file exactly to include? Do I have to download some files or can I just link to a site?
  20. I'll take a look at that tomorrow morning at work. Thanks!
  21. I reinstalled twice and didn't work.There is an option to install CF as a standalone server. Did that and works now.
  22. Yes. That's basically it. If they choose option 1 in select 1 then select 2 will have choices relative to select 1 option 1. Should have only around 3-4 options in the second select.Is AJAX like javascript?
  23. vchris

    Arrays

    I start with a <cfif>. It's another query which doesn't relate to this one so I didn't include it.
  24. vchris

    Firefox new tab

    YESSSSSSSSSSSSSS! :)Thanks RahXephon!
×
×
  • Create New...