[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

JavaScript, Coldfusion

I have created a form which supposed to populate the Category and degree. The population does working. The next step I need to do is by clicking on the populated degree show the description. This part does not work. Please help. This is Urgent

<cffunction name="GenerateAdmissionsWizardText">
            <cfargument name="stepId" required="yes" type="string">
            <cfargument name="degree" required="yes" type="string">
            
            <!--- call the stored proc that provides the list of applicable programs by school (or division). This data is stored in a HB table.--->
            
            <cfstoredproc procedure="spWebProgramList" datasource="#this.datasource#">
                  <cfprocparam type="in" cfsqltype="cf_sql_varchar" variable="@school" value="#session.schoolcode#">
                  <cfprocresult name="request.programlist">
            </cfstoredproc>                  
            
            <cfsavecontent variable="text_1_">
       
 
       
                  <h2>Step 1: Select your Program</h2>
           
            <cfoutput><p>Thank you for considering a program at the #session.schoolname#. Our goal is to ensure you have all the information you need to navigate the admissions process. Please follow the steps below. If you have additional questions, please don't hesitate to contact us at #session.appphonenumber# or email <a href="mailto:#session.appemail#">#session.appemail#</a>.</p></cfoutput>  
           
            <cfif session.schoolcode eq "education">
                  <p>Choose an area of interest from the list below:</p>
            <cfelse>    
                  <p>
                  Select the degree or certificate program to which you are interested in applying from the list below.  To choose more than one program, hold down the Ctrl key and click on each program name. MacIntosh users should hold down the apple key.  <em><strong>Choosing more than one program indicates that you are applying to multiple programs.</strong></em>
                  </p>      
                  </cfif>
                  
            
                  <cfoutput>
   <script language="javascript">
   var arrDegree=new Array;
   
   function Degree (id,categoryId,programnote){
   
               this.id=id;
            this.categoryId=categoryId;
            this.programnote=programnote;
            this.makeOption=makeOption;
            
            }
            
            function makeOption () {
            
                  return new Option (this.programnote,this.id);
            };
            
            <cfloop query="request.programlist">
                        arrDegree[arrDegree.lenght]=new Degree (#id#,#categoryId#,"#JSStringFormat(programnote)#");
                        </cfloop>
                        function fillDegree () {
                        
                              with (document.getElementById('programlist')) {
                                    if (selectedIndex==-1) {
                                    
                                          return ;
                                          }
                                          var programlist=options[selectedIndex].value;
                                          }
                                          for (var i=0;i<arrDegree.lenght;i++) {
                                          
                                                if (arrDegree[i].programlist==id) {
                                                
                                                      with (document.getelementById('note')) {
                                                            options[options.Lenght]=arrDegree[i].makeOption();
                                                            }
                                                            }
                                                            };
                                                            };
   
         
            
   </script>
            
           
            <cfif session.schoolcode eq "psl">
                        <form action="#script_name#?debug&step=2b&f=n" method="post" enctype="multipart/form-data" >
            <cfelse>
                  <form action="#script_name#?debug&step=2" method="post" enctype="multipart/form-data" >
            </cfif>        
                  </cfoutput>
       
                  <cfoutput query="request.programlist" group="category">
           
            <cfif session.schoolcode eq "education">
                  <h3><a href="admissions/?category=#categoryid#&step=1a">#category#</a></h3>
            <cfelse>
                <h3>#category#</h3>
                <select id="programlist" name="degree" multiple="true" size="#cnt#" onchange="fillDegree()">                  
                <cfoutput>
                    <option value="#id#">#webname#</option>
                </cfoutput>      
             
                </select>
         
             </cfif>  
    <div id="note" style="border:thin 1px dotted; width:500px; height:100px;">
     
       </div>
                  </cfoutput>
       
            <cfif session.schoolcode neq "education">
               <p> <input type="reset" name="reset" value="Reset">
                <input type="submit" name="submit" value="Select"></p>
               
            <cfelse>    
                <p><em>Inquiries about doctoral programs in education should be directed to the Department of Teacher Development and Leadership at 410-516-9755 or the Department of Special Education at 410-516-8275.</em></p>
            </cfif>    
                  </form>
            
            </cfsavecontent>
            
            <cfsavecontent variable="output">
              <cfif stepId eq "1a">
                  <cfoutput>#GenerateAdmissionsWizardStep1aText(category)#</cfoutput>
                  <cfelseif stepId EQ "2">
                        <cfif isdefined("form.degree")>
                              <cfoutput>#GenerateAdmissionsWizardStep2Text(form.degree)#</cfoutput>
                        <cfelse>
                              <cfoutput>#GenerateAdmissionsWizardStep2Text(degree)#</cfoutput>      
                        </cfif>      
                  <cfelseif stepId EQ "2a">
                        <cfoutput>#GenerateAdmissionsWizardStep2aText(degree)#</cfoutput>
                  <cfelseif stepId EQ "2b">
                        <cfoutput>#GenerateAdmissionsWizardStep2bText(degree)#</cfoutput>
                  <cfelseif stepId EQ "2c">
                        <cfoutput>#GenerateAdmissionsWizardStep2cText(degree)#</cfoutput>      
                  <cfelseif stepId EQ "3">
                        <cfoutput>#GenerateAdmissionsWizardStep3Text(degree)#</cfoutput>                        
                  <cfelseif stepId EQ "4">
                        <cfoutput>#GenerateAdmissionsWizardStep4Text(degree)#</cfoutput>
                  <cfelse>
                        <cfset evaluatedVar = Evaluate("text_#stepId#_#degree#")>
                        <cfoutput>#evaluatedVar#</cfoutput>
                  </cfif>
            </cfsavecontent>
            <cfreturn output>
      </cffunction>
      
0
erikTsomik
Asked:
erikTsomik
  • 3
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
Does the description need to be fetched from the server when you change the dropdown?

If not, can you please show the generated html without the cf tags?
0
 
erikTsomikSystem Architect, CF programmer Author Commented:
Yes description need to be fetched from the server.
0
 
Michel PlungjanIT ExpertCommented:
0
 
erikTsomikSystem Architect, CF programmer Author Commented:
Ok this is a good post. But How can I implement it in my case. I have the function inside of my cfc. How can i included in the cfscri[ptLocation. The code I posted it the only code I will have.
0
 
Michel PlungjanIT ExpertCommented:
I am sorry, I commented in JS only. Hopefully some CF people will be around
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now