473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Combining Function OnChk & function toggleSubmit(sel)

5
Hi All,

I have a form which checks which Submit button has been pressed and also shows a textarea dependant on an option selected.
The problem I have is that when I include my "display text" code, all submit buttons appear to be disabled.
However, when the "display text" is removed, the buttons function correctly.

Expand|Select|Wrap|Line Numbers
  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <%response.buffer=true%>
  3.  
  4. <script language="javascript">
  5. function chkSubmit(){
  6. document.ChangeControlForm.action="confirm5.asp";
  7. }
  8. function chkSave(){
  9. document.ChangeControlForm.action="save.asp";
  10. }
  11. function chkUpload(){
  12. document.ChangeControlForm.action="ToFileSystem.asp";
  13. }
  14.  
  15. </script>
  16. <script type="text/javascript">
  17.     //<![CDATA[
  18.     function toggleSubmit(sel)
  19.     {
  20.       var submit = document.getElementById('submit');
  21.       var area = document.getElementById('jarea');
  22.       submit.value = (sel.options[sel.selectedIndex].value=="yes") ? 'Submit Emergency Change' : 'Submit to Change Control';
  23.       jarea.style.display = (submit.value == 'Submit Emergency Change') ? 'block' : 'none';
  24.     }
  25.     //]]>
  26.  
  27. </script>
  28.  
  29. <head>
  30.  
  31. <title>Change Control Form</title>
  32.  
  33.  
  34. </head>
  35. <center>
  36. <h2>
  37. <img src="images/deault_01.jpg"></h2>
  38. <h2><font face="Sky InfoText Bd" color="#0388BB" size="6">
  39. CHANGE CONTROL FORM</font></h2>
  40.  
  41. <br><hr><br>
  42. <font color="#FF0000" face="InfoText Bd">Fields marked * are mandatory and must be completed before submitting to Change Control</font>
  43. <form name="ChangeControlForm" method="Post" enctype="multipart/form-data">
  44.  
  45.  
  46. </form>
  47.  
  48.  
  49. <div>
  50.  
  51.       <tr><td width="199">
  52.  
  53.       <label for="emergency"><span style="background-color: #260063">
  54.       <font color="#FFFFFF" face="InfoText Bd">Emergency Change?</font>:</span> </label> </td></tr>
  55.       <td width="17" align="center">&nbsp;</td>
  56.       <tr><td>
  57.         <select id="emergency" name="emergency" onchange="toggleSubmit(this);">
  58.           <option label="Yes" value="yes">Yes</option>
  59.           <option label="No" value="no" selected="selected">No</option>
  60.         </select>
  61.         </td></tr>
  62.  
  63.  
  64.  
  65.       <br />
  66.  
  67.  
  68.         <div id="jarea" style="display:none;">
  69.         <tr><td width="199">
  70.           <label for="justification"><font color="#FF0000" face="InfoText Bd">
  71.         <span style="background-color: #260063" width="199">Please provide 
  72.         justification for emergency change</span></font> </label> </td></tr>
  73.         <tr><td>
  74.         <textarea title="Please provide justification for emergency change" name="emergency_justification" cols="38" rows="3"></textarea>
  75.         </div>
  76. <br>
  77. <tr><td width="199" bgcolor="#260063">
  78.   <font color="#FFFFFF" face="InfoText Bd">Upload Attachment: </font> </td>
  79. <td width="17" align="center">&nbsp;</td>
  80. <td width="360"><input type="file" name="File1" size="20"><INPUT type="Submit" value="Upload" onClick="chkUpload();"></td></tr>
  81. </table>
  82. <br>
  83. <center>
  84. <table>
  85. <tr>
  86. <td>
  87. <input type="submit" name="Submit2" value="Save Progress" onClick="chkSave();"> 
  88. <input id="submit" type="submit" name="Submit" value="Submit to Change Control" onClick="chkSubmit();"> 
  89. </table>
  90. </form>
  91.  
I originally thought perhaps the </form> that precedes the <div> area could be causing the problem, but when I remove it, it makes no difference.

Any ideas???? :o
Jun 26 '06 #1
1 2313
acoder
16,027 Expert Mod 8TB
I originally thought perhaps the </form> that precedes the <div> area could be causing the problem, but when I remove it, it makes no difference.
It should be that which causes the problem. Also, jarea on line 23 should be "area".
Apr 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mark | last post by:
Hi - I have a dynamically created table, which has a number of forms - each named consecutively as 'adduserX' where X is a number generated from ASP. Within each form, I need to have a button...
1
by: DaVinci | last post by:
I did a google web & group search and didn't find an answer to my question so... here we go. Will try to keep it short. (I am not a complete beginner but am still pretty low on the food chain). ...
11
by: JS | last post by:
I have made a function createFirstMenu where I call "resetMenu" in a JavaScript. But nothing happens when I call resetMenu. function createFirstMenu(sel){ sel = document.getElementById('sel1');...
1
by: JS | last post by:
I have this form in test.jsp, that consists of 3 drop/down menus (sel1, sel2 and sel3): <body onload="createFirstMenu('sel1');"> <form name="sels" method="post" action=""> <select...
4
by: Robbie Hatley | last post by:
I've been playing with "auto_ptr" and the "Resource Acquisition Is Initialization" concept. On page 199 of Lippman's book "Effective C++" he says "All active local class objects of a function are...
20
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about...
0
by: Marty Scholes | last post by:
I may have found a bug. I have a table: CREATE TABLE onlpcd_stat ( sel BIGSERIAL PRIMARY KEY, user_id INTEGER NOT NULL REFERENCES onlpcd_user ON DELETE CASCADE, vars TEXT, /*...
0
by: Mr. Murad Jamal | last post by:
hi guys, I have a textbox & a button in an .aspx page, when I hit the button i want a selected text to be copied to the clipboard AND paste it into the last cursor position on the textbox BOTH AT...
9
by: Rick W. | last post by:
<script> function filldims() { var objSelect = document.getElementById("id_intwidth"); objSelect.options.length = 0; for(var i = 20; i < 31; i++) { var objOption =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.