Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question JS failing to write button

    I don't see why it is failing to write the button with the link.

    MajorRecords is a variable.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <script type="text/javascript">document.write"&nbsp;&nbsp;<a href='DBEditMajor.php' onclick='this.href+='?position='+MajorRecords'><input type='button' value='Save revisions' name='MajorRev' id='MajorRev' title='Store Major revisions' style='text-decoration: none' disabled ></a>"</script>
    </body>
    </html>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Where is MajorRecords coming from? Is it coming from a php script? Why don't you just use php to write the link? From the looks of it though you haven't been understanding what we've been trying to tell you. All you need is a form that uses get for the method.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form action="DBEditMajor.php" method="get">
    <input type="text" name="position" />
    <input type="submit" value="Save revisions" title="Store Major revisions" />
    </form>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    _Aerospace_Eng_,

    Here is the sequence of events to provide the MajorRecords value:
    1. A listbox is populated by a PHP script.
    2. Based upon listbox selection, the value for textbox "MajorEdit3" is determined
    3. MajorEdit3 is populated
    4. The value of MajorEdit3 is then passed to the JS variable MajorRecords

    The alert does reveal the correct information.

    The above works fine. But I'm having trouble passing the MajorRecords value into the URL so that PHP can GET the value.

    All the different attempts I've made have resulted in
    DBEditMajor.php?position=undefined
    OR

    using the present code below; the button fails to be created.

    The page I'm building allows the user to edit records from 4 different DB tables, so I can't use one form. I have to set up 4 HREF links, each calling a specific page to handle information (Majors, Minors, Concentrations and Theology).

    Code:
    <select name="Major" onchange="resolveData()"></select>
    
    <input type="text" name="MajorEdit3" id="MajorEdit3" size="3">
    
    function resolveData(){
    	var MajorRecords = (document.f1.MajorEdit3.value);
    	alert(MajorRecords);
    }
    The following allows the button to be created.
    Code:
    <!--<script type="text/javascript">document.write"-->
    &nbsp;&nbsp;<a href='DBEditMajor.php' onclick='this.href+='?position='+MajorRecords'><input type='button' value='Save revisions' name='MajorRev' id='MajorRev' title='Store Major revisions' style='text-decoration: none' disabled ></a>
    <!--"</script>-->
    Last edited by h8ids; 10-25-2006 at 09:28 PM.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I still think you are overcomplicating this. You said the list box gets generated by php then onchange that value populates a box (this is the part that I think is pointless) and then it makes the url. Why not just
    Code:
    <form action="DBEditMajor.php" method="get">
    <select name="position">
    <!--generated php stuff here-->
    </select>
    <input type="submit" value="Save revisions">
    </form>
    The above WILL work. If it doesn't then you've done something wrong. Tge above should submit to DBEditMajor.php. Since it uses get for the method position=something should be appended to the url so the url would look like
    Code:
    DBEditMajor.php?position=selectedvalue
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,009
    Thanks
    2
    Thanked 312 Times in 304 Posts
    Here is a link to a chained select form that does something similar to what you are doing - http://www.dynamicdrive.com/dynamici...ects/index.htm

    To use this code, and the same for what your current code is doing, once you select items/fill in form fields, you just submit the form. You can use either the POST or GET method, you don't have to build you own url to submit data.

    There are 10's or 100's of thousands of forms like yours on the Internet, where selecting a value in one drop down, populates something else, which you then select an item... Those 10's of thousands of programmers that created these did not do it the way you are attempting. It is not as hard as you are making it.

    Edit: Is there a location where a complete and current version of all of your main code is posted so that someone might try it. I previously tried code you posted here just to see what the form looked like. Perhaps someone can try this and point out the specific changes to the form to cause it to submit.

    Edit2: After playing with the form and reviewing a few of your other threads related to this, I have a short answer to the problem - the name of the input field/$_POST variable will tell you where the data originated at and where it needs to be updated/added/deleted... If any of the four choices was not changed, you can either detect this in PHP code (for example having a hidden field with the original selection, if any and comparing what is selected with what was sent) or you can just put the same data into an UPDATE statement (mysql detects if the current value and the new value are the same and does not bother to update where the new value is the same as the existing value.)
    Last edited by CFMaBiSmAd; 10-26-2006 at 12:44 AM.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #6
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's the source code; and it's a lot.

    Select, Add, Edit and Delete page (Populating, Selecting and Adding to DB works fine. Focusing only on editing records.)
    There is a .js include file; code is shown at bottom.
    Removed irrelevant code.

    Developing for IE and Firefox. My past attempts with multiple FORMS in IE have failed. IE sees the first complete form but wouldn't follow up on the remaining forms.

    All-in-one page.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <HTML>
    <HEAD>
    <title>Database edit page</title>
    <META NAME="EXPIRES" CONTENT="Mon, 01 Jan 2000 12:00:00 GMT">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <script src="javascript.js" type="text/javascript"></script>
    </HEAD>
    	<body marginheight="0" topmargin="0" onload="hidden()">
    
    <!-- Form Border image and -->
    	<div style="position: absolute; left: 5%;">
    
    <!-- Beginning of form input -->
    	<div style="position: absolute; width: 580px; left: 60px; top: 40px; z-index:3">
    
    		<b>Database edit tool</b>
    	</div>
    
    <form name="f1" enctype="multipart/form-data" action="dataResolver.php" method="POST">
    
          <!-- Table positioning -->
    	<div style="position: absolute; width: 635px; left: 40px; top: 85px; z-index:1">
    
    <table width='631' cellspacing='0'>
    	<thead>
    		<tr><th colspan="2">Add, Edit or Delete information</th>
    		</tr>
    	</thead>
    
    	<tr bgcolor='#E0E0E0'>
    <!--Second step-->
    		<td width="481">&nbsp;Majors:&nbsp;<select name="Major" id="MajorChoice" onchange="show('MajorEdit'); hide('MinorEdit'); hide('ConcenEdit'); hide('TheologyEdit'); hide('MajorAdd'); hide('MinorAdd'); hide('ConcenAdd'); hide('TheologyAdd'); testMajor(this); document.getElementById('MinorChoice').selectedIndex=0; document.getElementById('ConcenChoice').selectedIndex=0; document.getElementById('TheolChoice').selectedIndex=0;"></select></td>
    
    	<!-- Add Edit Delete buttons -->
    		<td width="150">
    		&nbsp;<input type="button" value="Add" name="MajAdd" id="MajAdd" onclick="show('MajorAdd'); hide('MajorEdit'); hide('TheologyEdit'); hide('ConcenEdit'); hide('ConcenAdd'); hide('MinorEdit'); hide('MinorAdd'); hide('TheologyAdd'); document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('MinorChoice').selectedIndex=0; document.getElementById('ConcenChoice').selectedIndex=0; document.getElementById('TheolChoice').selectedIndex=0">
    		&nbsp;<input type="button" value="Delete" name="MajorDelete" onclick="resolveData();">
    		</td>
    
    	</tr><tr>
    		<td>
    		&nbsp;<div name="MajorAdd" id="MajorAdd" style='display: none'>
    		&nbsp;&nbsp;<b>Add</b> a Major.
    		<input type='text' id='Majorcode' name='MajorCode' size='4' maxlength='4'>
    		<input type='text' id='Majors' name='Majors' size='35' maxlength='50'><br>
    		&nbsp;&nbsp;<input type="submit" value="Add Major" name="Add Major" title="Add Major" onclick="this.form.action='DBAddMajor.php'"><p>
    		</div>
    
    		<div id="MajorEdit" name="MajorEdit" style='display: none'>
    		&nbsp;&nbsp;<b>Edit</b> a Major.
    		<input type="text" name="MajorEdit" id="MajorEdit" size="4" onclick="activeMajorRev()">
    		<input type="text" name="MajorEdit2" size="35" onclick="activeMajorRev()">
    		<!-- Record number -->
    
    		<input type="text" name="MajorEdit3" id="MajorEdit3" size="3">
    		<script language="javascript">		
    	function resolveData2(){
    	var MajorRecords = (document.f1.MajorEdit3.value);
    	alert(MajorRecords);
    }
    		</script>
    
    		<br>
    <!--Third step-->
    		<!--<script type="text/javascript">document.write"-->
    		&nbsp;&nbsp;<a href="DBEditMajor.php" onclick="this.href+='?position='+resolveData2(); "><input type='button' value='Save revisions' name='MajorRev' id='MajorRev' title='Store Major revisions' style='text-decoration: none' disabled ></a><!--</script>-->
    		<p></div>
    
    		</td>
    	</tr>
    
    	<tr bgcolor='#E0E0E0'>
    		<td width="481">&nbsp;Minors:&nbsp;<select name="Minor" id="MinorChoice" onchange="show('MinorEdit'); hide('MajorEdit'); hide('ConcenEdit'); hide('TheologyEdit'); hide('MinorAdd'); hide('MajorAdd'); hide('ConcenAdd'); hide('TheologyAdd'); testMinor(this); document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('ConcenChoice').selectedIndex=0; document.getElementById('TheolChoice').selectedIndex=0"></select></td>
    		<td width="150">
    	<!-- Add Edit Delete buttons -->
    		&nbsp;<input type="button" value="Add" name="MinAdd" id="MinAdd" onclick="show('MinorAdd'); hide('MinorEdit'); hide('TheologyEdit'); hide('ConcenEdit'); hide('ConcenAdd'); hide('MajorEdit'); hide('MajorAdd'); hide('TheologyAdd'); document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('ConcenChoice').selectedIndex=0; document.getElementById('TheolChoice').selectedIndex=0; document.getElementById('MinorChoice').selectedIndex=0">
    		&nbsp;<input type="button" value="Delete" name="MinorDelete" onclick="resolveData();">
    		</td>
    	</tr><tr>
    		<td>
    
    		&nbsp;<div id="MinorAdd" name="MinorAdd" style='display: none'>
    		&nbsp;&nbsp;<b>Add</b> a Minor.
    		<input type='text' id='MinorCode' name='MinorCode' size='4' maxlength='4'>
    		<input type='text' id='Minor' name='Minors' size='35' maxlength='50'><br>
    		&nbsp;&nbsp;<input type="submit" value="Add Minor" name="Add Minor" title="Add Minor" onclick="this.form.action='DBAddMinor.php'"><p>
    		</div>
    		<div id="MinorEdit" name="MinorEdit" style='display: none'>
    		&nbsp;&nbsp;<b>Edit</b> a Minor.
    		<input type="text" name="MinorEdit" id="MinorEdit" size="4" onclick="activeMinorRev()">
    
    		<input type="text" name="MinorEdit2" size="35" onclick="activeMinorRev()">
    		<input type="hidden" name="MinorEdit3" size="3"><br>
    		&nbsp;&nbsp;<input disabled type="submit" value="Save revisions" name="MinorRev" id="MinorRev" title="Store Minor revisions" onclick="this.form.action='DBEditMinor.php'; resolveData();">
    		<p></div>
    		</td>
    	</tr>
    
    	<tr bgcolor='#E0E0E0'>
    		<td width="481">&nbsp;Concentrations:&nbsp;<select name="Concen" id="ConcenChoice" onchange="show('ConcenEdit'); hide('MajorEdit'); hide('MinorEdit'); hide('TheologyEdit'); hide('ConcenAdd'); hide('MajorAdd'); hide('MinorAdd'); hide('TheologyAdd'); testConcen(this); document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('MinorChoice').selectedIndex=0; document.getElementById('TheolChoice').selectedIndex=0"></select></td>
    
    		<td width="150">
    	<!-- Add Edit Delete buttons -->
    		&nbsp;<input type="button" value="Add" name="ConcAdd" id="Add" onclick="hide('ConcenEdit'); hide('TheologyEdit'); hide('MinorEdit'); hide('MinorAdd'); hide('MajorEdit'); hide('MajorAdd'); hide('TheologyAdd'); show('ConcenAdd'); document.getElementById('ConcenChoice').selectedIndex=0; document.getElementById('TheolChoice').selectedIndex=0; document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('MinorChoice').selectedIndex=0;">
    		&nbsp;<input type="button" value="Delete" name="ConcenDelete" onclick="resolveData();">
    		</td>
    	</tr><tr>
    		<td>
    		&nbsp;<div id="ConcenAdd" name="ConcenAdd" style='display: none'>
    		&nbsp;&nbsp;<b>Add</b> a Concentration.
    		<input type='text' id='ConcenCode' name='ConcenCode' size='4' maxlength='4'>
    
    		<input type='text' id='Concen' name='Concen' size='35' maxlength='50'><br>
    		&nbsp;&nbsp;<input type="submit" value="Add Concentration" name="Add Concentration" title="Add Concentration" onclick="this.form.action='DBAddConcen.php'"><p>
    		</div>
    		<div id="ConcenEdit" name="ConcenEdit" style='display: none'>
    		&nbsp;&nbsp;<b>Edit</b> a Concentration.
    		<input type="text" name="ConcenEdit" id="ConcenEdit" size="4" onclick="activeConcenRev()">
    		<input type="text" name="ConcenEdit2" size="35" onclick="activeConcenRev()">
    		<input type="hidden" name="ConcenEdit3" size="3"><br>
    
    		&nbsp;&nbsp;<input disabled type="submit" value="Save revisions" name="ConcenRev" id="ConcenRev" title="Store Concentration revisions" onclick="this.form.action='DBEditConcen.php';resolveData();">
    		<p></div>
    		</td>
    	</tr>
    
    	<tr bgcolor='#E0E0E0'>
    		<td width="481">&nbsp;School of Theology majors:&nbsp;<select name="Theology" id="TheolChoice" onchange="show('TheologyEdit'); hide('ConcenEdit'); hide('MinorEdit'); hide('MajorEdit'); hide('TheologyAdd'); hide('ConcenAdd'); hide('MinorAdd'); hide('MajorAdd'); testTheology(this); document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('MinorChoice').selectedIndex=0; document.getElementById('ConcenChoice').selectedIndex=0"></select></td>
    		<td width="150">
    	<!-- Add Edit Delete buttons -->
    
    		&nbsp;<input type="button" value="Add" name="TheolAdd" id="Add" onclick="hide('TheologyEdit'); hide('ConcenEdit'); hide('ConcenAdd'); hide('MinorEdit'); hide('MinorAdd'); hide('MajorEdit'); hide('MajorAdd'); show('TheologyAdd'); document.getElementById('TheolChoice').selectedIndex=0; document.getElementById('MajorChoice').selectedIndex=0; document.getElementById('MinorChoice').selectedIndex=0; document.getElementById('ConcenChoice').selectedIndex=0;">
    		&nbsp;<input type="button" value="Delete" name="TheologyDelete" onclick="resolveData();">
    		</td>
    	</tr><tr>
    		<td>
    		&nbsp;<div id="TheologyAdd" name="TheologyAdd" style='display: none'>
    		&nbsp;&nbsp;<b>Add</b> a Theology major.
    		<input type='text' id='TheologyCode' name='TheologyCode' size='4' maxlength='4'>
    
    		<input type='text' id='Theology' name='Theology' size='35' maxlength='50'><br>
    		&nbsp;&nbsp;<input type="submit" value="Add Theology Major" name="Add Theology Major" title="Add Theology Major" onclick="this.form.action='DBAddTheology.php'"><p>
    		</div>
    		<div id="TheologyEdit" name="TheologyEdit" style='display: none'>
    		&nbsp;&nbsp;<b>Edit</b> a Theology major.
    		<input type="text" name="TheologyEdit" id="TheologyEdit" size="4" onclick="activeTheolRev()">
    		<input type="text" name="TheologyEdit2" size="35" onclick="activeTheolRev()">
    		<input type="hidden" name="TheologyEdit3" size="3"><br>
    
    		&nbsp;&nbsp;<input disabled type="submit" value="Save revisions" name="TheolRev" id="TheolRev" title="Store Theology revisions" onclick="this.form.action='DBEditTheology.php'; resolveData();">
    		<p></div>
    		</td>
    	</tr>
    
    	<tfoot>
    		<tr><td colspan='4' >&nbsp;</td></tr>
    	</tfoot>
    </table>
    </DIV>
    
    </form>
    
    <script type="text/javascript">
    	var empMajorChoice = [		['1','Please Choose One','Please Choose One'],['2','AMST','American Studies'],['3','ANGL','Anglican Studies'],['4','ANTH','Anthropology'],['5','ART','Art'],['6','ARTH','Art History'],['7','ASIA','Asian Studies'],['8','BIBL','Bible'],['9','BIOL','Biology'],['10','CEMT','Christian Ethics Moral Theology'],['11','CHEM','Chemistry'],['12','CHHT','Church History Historical Theology'],['13','CHIN','Chinese'],['14','CLST','Classical Studies'],['15','CSCI','Computer Science'],['16','ECON','Economics'],['17','EDUC','Teacher Education'],['18','ENGL','English'],['19','ENST','Environmental Studies'],['20','FORS','Forestry'],['21','FREN','French'],['22','FRST','French Studies'],['23','GEOL','Geology'],['24','GREK','Greek'],['25','GRMN','German and German Studies'],['26','HIST','History'],['27','HOML','Homiletics'],['28','HUMN','Interdisciplinary Humanities'],['29','ITAL','Italian'],['30','JAPN','Japanese'],['31','LATN','Latin'],['32','LIBR','Library Science'],['33','LTCM','Liturgics and Church Music'],['34','MATH','Mathematics'],['35','MDST','Medieval Studies'],['36','MNST','Ministry Theory and Practice'],['37','MUSC','Music'],['38','NATR','Natural Sciences'],['39','NOND','Non Departmental'],['40','PHED','Physical Education'],['41','PHIL','Philosophy'],['42','PHYS','Physics'],['43','POLS','Political Science'],['44','PSYC','Psychology'],['45','RELG','Religion'],['46','RUSN','Russian'],['47','SPAN','Spanish'],['48','SPRT','Spirituality'],['49','SSFL','Social Science Foreign Language'],['50','STAT','Statistics'],['51','THEO','Theology Systematic'],['52','THTR','Theatre Arts'],['53','TWST','Third World Studies'],['54','WMST','Women Studies'],['55','H8ID','IDs R No Fun']	];
    //Collecting of paired data for Major presentation
    for(var a=0;a<empMajorChoice.length;a++){
    document.f1.MajorChoice[document.f1.MajorChoice.length] = new Option(empMajorChoice[a][2],empMajorChoice[a][1],empMajorChoice[a][0],empMajorChoice[a][3])
    }
    
    
    	var empMinorChoice = [
    		['1','Please Choose One','Please Choose One'],['2','ANTH','Anthropology'],['3','ARTH','Art History'],['4','ASIA','Asian Studies'],['5','BIOC','BioChemistry'],['6','BIOL','Biology'],['7','CHEM','Chemistry'],['8','CSCI','Computer Science'],['9','ECON','Economics'],['10','ENVS','Environmental Studies'],['11','FINA','Fine Arts'],['12','FREN','French'],['13','FRST','French Studies'],['14','GREK','Greek'],['15','GRMN','German'],['16','HIST','History'],['17','INGS','International and Global Studies'],['18','LATN','Latin'],['19','MACS','Mathematics and Computer Science'],['20','MATH','Mathematics'],['21','MUSC','Music'],['22','PHAS','Physics and Astronomy'],['23','PHIL','Philosophy'],['24','POLS','Political Science'],['25','PSYC','Psychology'],['26','RELG','Religion'],['27','RUSN','Russian'],['28','SPAN','Spanish'],['29','THTR','Theatre Arts'],['30','TWST','Third World Studies']	];
    //Collecting of paired data for Minor presentation
    for(var b=0;b<empMinorChoice.length;b++){
    document.f1.MinorChoice[document.f1.MinorChoice.length] = new Option(empMinorChoice[b][2],empMinorChoice[b][1],empMinorChoice[b][0],empMinorChoice[b][3])
    }
    
    
    	var empConcenChoice = [
    		['1','','Please Choose One'],['2','EDU','Education'],['3','WMST','Womens Studies']	];
    //Collecting of paired data for Concentration presentation
    for(var c=0;c<empConcenChoice.length;c++){
    document.f1.ConcenChoice[document.f1.ConcenChoice.length] = new Option(empConcenChoice[c][2],empConcenChoice[c][1],empConcenChoice[c][0],empConcenChoice[c][3])
    }
    
    
    	var empTheolChoice = [
    		['1','','Please Choose One'],['2','BIBL','Bible'],['3','CEMT','Christian Ethics Moral Theology'],['4','CHHT','Church History Historical Theology'],['5','HOML','Homiletics'],['6','LTCM','Liturgics and Church Music'],['7','MNST','Ministry Theory and Practice'],['8','SPRT','Spirituality'],['9','THEO','Theology Systematic'],['15','NEW','THEOLOGY MAJOR IE']	];
    //Collecting of paired data for Theology presentation
    for(var d=0;d<empTheolChoice.length;d++){
    document.f1.TheolChoice[document.f1.TheolChoice.length] = new Option(empTheolChoice[d][2],empTheolChoice[d][1],empTheolChoice[d][0],empTheolChoice[d][3])
    }
    </script>
    </DIV>
    </BODY>
    </HTML>
    The called page:
    Code:
    <HTML>
    <HEAD>
    <title>Edit Course Details</title>
    <META NAME="EXPIRES" CONTENT="Mon, 01 Jan 2000 12:00:00 GMT">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <script src="javascript.js"></script>
    <center><b><noscript><p><br>Please enable JavaScript within your browser so this page will function appropriately.<br>
    Then press the browser's refresh button.</noscript></b></center>
    </HEAD>
    <body>
    <script language=javascript>
    alert(MajorRecords)
    </script>
    <!--Drawing information from specified records -->
    <br />
    <b>Notice</b>:  Undefined index:  MajorRecords in <b>C:\Program Files\Apache Group\Apache2\htdocs\DBEditMajor.php</b> on line <b>22</b><br />
    
    <br />
    <b>Notice</b>:  Undefined index:  MajorRecords in <b>C:\Program Files\Apache Group\Apache2\htdocs\DBEditMajor.php</b> on line <b>23</b><br />
    <br />
    <b>Notice</b>:  Undefined variable: update in <b>C:\Program Files\Apache Group\Apache2\htdocs\DBEditMajor.php</b> on line <b>27</b><br />
    </body>
    </HTML>
    .js include:
    Code:
    //Revealing edit fields based upon selection
    //Major
    function hide(){
    var MajorEdit = document.getElementById(arguments[0]);
    MajorEdit.style.display="none";
    }
    function show(){
    var MajorEdit = document.getElementById(arguments[0]);
    MajorEdit.style.display="";
    }
    //Minor
    function hide(){
    var MinorEdit = document.getElementById(arguments[0]);
    MinorEdit.style.display="none";
    }
    function show(){
    var MinorEdit = document.getElementById(arguments[0]);
    MinorEdit.style.display="";
    }
    //Concentration
    function hide(){
    var ConcenEdit = document.getElementById(arguments[0]);
    ConcenEdit.style.display="none";
    }
    function show(){
    var ConcenEdit = document.getElementById(arguments[0]);
    ConcenEdit.style.display="";
    }
    //Theology
    function hide(){
    var TheologyEdit = document.getElementById(arguments[0]);
    TheologyEdit.style.display="none";
    }
    function show(){
    var TheologyEdit = document.getElementById(arguments[0]);
    TheologyEdit.style.display="";
    }
    
    //Revision submission button status
    function activeMajorRev(){
    	document.f1.MajorRev.disabled = false;
    }
    function activeMinorRev(){
    	document.f1.MinorRev.disabled = false;
    }
    function activeConcenRev(){
    	document.f1.ConcenRev.disabled = false;
    }
    function activeTheolRev(){
    	document.f1.TheolRev.disabled = false;
    }
    
    // Populating Major Edit fields
    function testMajor(objMajor){
    if(objMajor.selectedIndex!=0){
    document.f1.MajorEdit.value=empMajorChoice[objMajor.selectedIndex][1]
    document.f1.MajorEdit2.value=empMajorChoice[objMajor.selectedIndex][2]
    document.f1.MajorEdit3.value=empMajorChoice[objMajor.selectedIndex][0]
    } else {
    	document.f1.MajorEdit.value="";
    	document.f1.MajorEdit2.value="";
    	document.f1.MajorEdit3.value="";
    }
    }
    
    // Populating Minor fields
    function testMinor(objMinor){
    if(objMinor.selectedIndex!=0){
    document.f1.MinorEdit.value=empMinorChoice[objMinor.selectedIndex][1]
    document.f1.MinorEdit2.value=empMinorChoice[objMinor.selectedIndex][2]
    document.f1.MinorEdit3.value=empMinorChoice[objMinor.selectedIndex][0]
    } else {
    	document.f1.MinorEdit.value="";
    	document.f1.MinorEdit2.value="";
    	document.f1.MinorEdit3.value="";
    }
    }
    
    // Populating Concentration fields
    function testConcen(objConcen){
    if(objConcen.selectedIndex!=0){
    document.f1.ConcenEdit.value=empConcenChoice[objConcen.selectedIndex][1]
    document.f1.ConcenEdit2.value=empConcenChoice[objConcen.selectedIndex][2]
    document.f1.ConcenEdit3.value=empConcenChoice[objConcen.selectedIndex][0]
    } else {
    	document.f1.ConcenEdit.value="";
    	document.f1.ConcenEdit2.value="";
    	document.f1.ConcenEdit3.value="";
    }
    }
    // Populating Theology fields
    function testTheology(objTheology){
    if(objTheology.selectedIndex!=0){
    document.f1.TheologyEdit.value=empTheolChoice[objTheology.selectedIndex][1]
    document.f1.TheologyEdit2.value=empTheolChoice[objTheology.selectedIndex][2]
    document.f1.TheologyEdit3.value=empTheolChoice[objTheology.selectedIndex][0]
    } else {
    	document.f1.TheologyEdit.value="";
    	document.f1.TheologyEdit2.value="";
    	document.f1.TheologyEdit3.value="";
    }
    }
    Last edited by h8ids; 10-26-2006 at 04:06 PM.

  • #7
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,009
    Thanks
    2
    Thanked 312 Times in 304 Posts
    I have part of an answer as to why this does not work - you cannot define a javascript function in the body of the document and call it. Functions must be defined in the head section of the document.

    Edit: Also, your middle piece of code with the notice messages for - MajorRecords. This is apparently from the PHP code file. There is no form input field with that name and no url parameter with that name, so if you attempt to do a $_GET['MajorRecords'] or $_POST['MajorRecords'] it will fail.
    Last edited by CFMaBiSmAd; 10-26-2006 at 05:36 PM.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #8
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Made some changes.

    Functions must be defined in the head section of the document.
    Moved the following code to the .js include file. The ALERT is still presenting the correct data based upon selection.
    Code:
    function resolveData(){
    	var MajorRecords = (document.f1.MajorEdit3.value);
    	//alert('second - called from function');
    	alert(MajorRecords);
    }
    I'll will try using one FORM for the four individual SUBMIT buttons. THANKS!


    Edit: Also, your middle piece of code with the notice messages for - MajorRecords. This is apparently from the PHP code file. There is no form input field with that name and no url parameter with that name, so if you attempt to do a $_GET['MajorRecords'] or $_POST['MajorRecords'] it will fail.

  • #9
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    With everyone's assistance, I believe I have found a solution for my project.

    Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •