Originally posted by dmjpro
ListItems added using Js gets cleared on Page load?
Collapse
X
-
-
Originally posted by sudhaMurugesanI myself confused a lot. I dont know what was happening. I give you my whole code sir. you please check where i am wrong.But please give me some time to explain u what i'm really doing. Is it Time up for you now and I too have got only 15 mins.
Can't you make me clear?
Actually why "degree" Select Box is null initially?
And you populate the "major" Select Box when you change first one, right?
oh.....I am now getting confused.
Tell me actual scenario and paste the Generated HTML and whole JavaScript.
So that I can have a look at this and make me understand myself.
Debasis JanaComment
-
Originally posted by dmjproRight now I am getting confused.
Can't you make me clear?
Actually why "degree" Select Box is null initially?
And you populate the "major" Select Box when you change first one, right?
oh.....I am now getting confused.
Tell me actual scenario and paste the Generated HTML and whole JavaScript.
So that I can have a look at this and make me understand myself.
Debasis Jana
Degrees[B.A/B.E] Majors for B.A[English,History] for B.E[ECE,EEE,IT]
Now if i Select B.A in degree select box, the Majors for B.A gets binded in Major selectbox dynamically using javascript. Now If i select English as Major and click Save button, the Value English is not carried to Server side[C#.net] where i save the value to database . Some of my colleagues saying me to capture the value in hidden fields and then pass to server side. I know that this is not effective.In generated Html also the major's selected value is 0 having text "--Select--". I will Paste the Generated HTML code also. I value ur suggestion more.
Thank U.Comment
-
Originally posted by dmjproRight now I am getting confused.
Can't you make me clear?
Actually why "degree" Select Box is null initially?
And you populate the "major" Select Box when you change first one, right?
oh.....I am now getting confused.
Tell me actual scenario and paste the Generated HTML and whole JavaScript.
So that I can have a look at this and make me understand myself.
Debasis Jana
Code:<tr> <td> <span id="ctl00_ContentPlaceHolder1_Label66">Qualification Level</span></td> <td> <select name="ctl00$ContentPlaceHolder1$ddlQualification" id="ctl00_ContentPlaceHolder1_ddlQualification" onchange="HideQualification();getQualification();" style="width:71%;"> <option selected="selected" value="0">---Select---</option> <option value="38">SSLC</option> <option value="39">HSC</option> <option value="40">ITI</option> <option value="41">DIPLOMA</option> <option value="42">NON-ENGG GRADUATE</option> <option value="44">ENGG GRADUATE</option> </select> <span id="ctl00_ContentPlaceHolder1_Label28" class="ErrorText">*</span></td> <td > <div id="ctl00_ContentPlaceHolder1_DivlblInstitute"><span id="ctl00_ContentPlaceHolder1_lblInstitute">Institute :</span> </div> </td> <td > <div id="ctl00_ContentPlaceHolder1_DivtxtInstitute"> <input name="ctl00$ContentPlaceHolder1$txtInstitute" type="text" id="ctl00_ContentPlaceHolder1_txtInstitute" onkeypress="FilterChracterInputs();" style="width:160px;" /> <span id="ctl00_ContentPlaceHolder1_Label9" class="ErrorText">*</span></div> </td> </tr> <tr id="ctl00_ContentPlaceHolder1_trdegree"> <td> <span id="ctl00_ContentPlaceHolder1_lblDegree">Degree</span></td> <td><select name="ctl00$ContentPlaceHolder1$ddlDegree" id="ctl00_ContentPlaceHolder1_ddlDegree" onchange="Major();" style="width:71%;"> <option selected="selected" value="0">----Select----</option> </select> <span id="ctl00_ContentPlaceHolder1_Label19" class="ErrorText">*</span></td> <td> <span id="ctl00_ContentPlaceHolder1_lblMajor">Major</span></td> <td> <select name="ctl00$ContentPlaceHolder1$ddlMajor" id="ctl00_ContentPlaceHolder1_ddlMajor" style="width:87%;"> <option value="0">----Select----</option> </select> <span id="ctl00_ContentPlaceHolder1_Label16" class="ErrorText">*</span></td> </tr> //javascript function getQualification() { var e = document.getElementById ("ctl00_ContentPlaceHolder1_ddlQualification"); var qualification = e.options[e.selectedIndex].text;[B] // eg. ENGG GRADUATE[/B] if(e.selectedIndex != 0) { AjaxWebService.GetDegree(qualification,OnGetDegree); //Returns Items[n] } } function OnGetDegree(Items) { [B]//Items[0] = "44,B.E/B.Tech"[/B] var degri = document.getElementById ("ctl00_ContentPlaceHolder1_ddlDegree"); var length = degri.options.length; if(degri.options.length > 0) { degri.options.length = 0; // var count=0; // for ( ; count < e.options.length ;) // { // e.remove(count); // count = 0; // } } var o = document.createElement("option"); o.text = "----Select----"; o.value = 0; degri.add(o); for(i=0;i<Items.length;i++) { var options = Items[i].split(","); var o = document.createElement("option"); o.text = options[1]; // "B.E/B.Tech" o.value = options[0]; // "44 " degri.add(o); } } function Major() { var deg = document.getElementById ("ctl00_ContentPlaceHolder1_ddlDegree"); if(deg.selectedIndex != 0) { AjaxWebService.GetMajor(deg.options[deg.selectedIndex].value,OnGetMajor); } } function OnGetMajor(Items) { [B]//Items[0] = "2,ECE" Items[1] = "3,EEE"[/B] var major = document.getElementById ("ctl00_ContentPlaceHolder1_ddlMajor"); if(major.options.length > 0) { major.options.length = 0;// to remove previously binded items } var o = document.createElement("option"); o.text = "----Select----"; o.value = 0; major.add(o); for(i=0;i<Items.length;i++) { var options = Items[i].split(","); var o = document.createElement("option"); o.text = options[1]; o.value = options[0]; major.add(o); } }
Comment
-
Now tell me Sudha.......... ...
You don't want to get the Degree List blank initially?
Then you can send me your Server Side Script.
As .Net & J2eeis almost same.
So I can have a look at this.
Don't you have any "<body onload="some_fu nc()">"?
Please let me all these things and send me the Server Side Script.
Debasis Jana.Comment
-
Originally posted by dmjproNow tell me Sudha.......... ...
You don't want to get the Degree List blank initially?
Then you can send me your Server Side Script.
As .Net & J2eeis almost same.
So I can have a look at this.
Don't you have any "<body onload="some_fu nc()">"?
Please let me all these things and send me the Server Side Script.
Debasis Jana.
Code:<script type="text/javascript" language="javascript"> //These js Functions gets called on load HideESI() HideOldBank() HideforDL() HideQualification() HideExperience() Major() </script>
Comment
-
Originally posted by sudhaMurugesanHow to send it is 950 lines. I tried thro' gmail but failed
Code:<script type="text/javascript" language="javascript"> //These js Functions gets called on load HideESI() HideOldBank() HideforDL() HideQualification() HideExperience() Major() </script>
Debasis JanaComment
-
Originally posted by dmjproThere you can't figure Out.?
Debasis JanaComment
-
Originally posted by dmjproBest of Luck with that.
Debasis Jana
My tries all failed.Hidden field is also failed becoz' on Bodyload call to AjaxWebservice fails . so My select box filled with no options. only this options value i am storing in hidfield which thro's error : option is null. So I finally decided to do it on Server Side. I am very bad in understanding the control flow which swallowed all my time. OK Jana check your PM.Comment
-
Originally posted by sudhaMurugesanhello Jana,
My tries all failed.Hidden field is also failed becoz' on Bodyload call to AjaxWebservice fails . so My select box filled with no options. only this options value i am storing in hidfield which thro's error : option is null. So I finally decided to do it on Server Side. I am very bad in understanding the control flow which swallowed all my time. OK Jana check your PM.
Debasis JanaComment
Comment