Really Stuck - ASP/Javascript Form Validation

Thread Solved

Join Date: Jun 2008
Posts: 4
Reputation: Felipo is an unknown quantity at this point 
Solved Threads: 0
Felipo Felipo is offline Offline
Newbie Poster

Really Stuck - ASP/Javascript Form Validation

 
0
  #1
Jun 5th, 2008
Hi Folks -

I have been spending gays spinning my wheels on getting some form validation to work -

I have text boxes and radio buttons on the form -

The validaiton is written in Javascript

It is an ASP web page -

It seems that the Javascript validation code is just ignored - Very weird -

I use onsubmit and have used onclick - and the results are always the same, the validation code is not performed -

I use dreamweaver 8 (dreamweaver CS2) as my web authoring tool and use MS Access as my database right now -

In the method parameter of the form tag I have used the 2 different parameters - One parameter I used is the actual page name to go to when the validation is succesful - I have also used the MM_Edit parameter supplied by Dreamweaver in the method for th eform as well -

I will list my code - I hope somebody can see what I am not seeing and get me over this hurdle -

Thank You for reading and trying to help me -

  1. <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="Connections/ConnStudio.asp" -->
  3. <%
  4. // *** Edit Operations: declare variables
  5.  
  6. // set the form action variable
  7. var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
  8. if (Request.QueryString) {
  9. MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
  10. }
  11.  
  12. // boolean to abort record edit
  13. var MM_abortEdit = false;
  14.  
  15. // query string to execute
  16. var MM_editQuery = "";
  17. %>
  18. <%
  19. // *** Insert Record: set variables
  20.  
  21. if (String(Request("MM_insert")) == "StudioReviewForm") {
  22.  
  23. var MM_editConnection = MM_ConnStudio_STRING;
  24. var MM_editTable = "Reviews";
  25. var MM_editRedirectUrl = "StudioReviewConfirmation.asp";
  26. var MM_fieldsStr = "SubmittedBy|value|HiddenStudioPhoneNumber|value|Courteous|value|Knowlegable|value|Affordable|value|Sanitary|value|GoodQualityWork|value|OverallRating|value|AdditionalComments1|value";
  27. var MM_columnsStr = "SubmittedBy|',none,''|StudioPhoneNumber|',none,''|CourteousService|none,1,0|KnowledgableStaff|none,1,0|AffordablePrices|none,1,0|GoodSanitaryConditions|none,1,0|GoodWorkQuality|none,1,0|OverallRating|',none,''|AdditionalComments1|',none,''";
  28.  
  29. // create the MM_fields and MM_columns arrays
  30. var MM_fields = MM_fieldsStr.split("|");
  31. var MM_columns = MM_columnsStr.split("|");
  32.  
  33. // set the form values
  34. for (var i=0; i+1 < MM_fields.length; i+=2) {
  35. MM_fields[i+1] = String(Request.Form(MM_fields[i]));
  36. }
  37.  
  38. // append the query string to the redirect URL
  39. if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
  40. MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
  41. }
  42. }
  43. %>
  44. <%
  45. // *** Insert Record: construct a sql insert statement and execute it
  46.  
  47. if (String(Request("MM_insert")) != "undefined") {
  48.  
  49. // create the sql insert statement
  50. var MM_tableValues = "", MM_dbValues = "";
  51. for (var i=0; i+1 < MM_fields.length; i+=2) {
  52. var formVal = MM_fields[i+1];
  53. var MM_typesArray = MM_columns[i+1].split(",");
  54. var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
  55. var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
  56. var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
  57. if (formVal == "" || formVal == "undefined") {
  58. formVal = emptyVal;
  59. } else {
  60. if (altVal != "") {
  61. formVal = altVal;
  62. } else if (delim == "'") { // escape quotes
  63. formVal = "'" + formVal.replace(/'/g,"''") + "'";
  64. } else {
  65. formVal = delim + formVal + delim;
  66. }
  67. }
  68. MM_tableValues += ((i != 0) ? "," : "") + MM_columns[i];
  69. MM_dbValues += ((i != 0) ? "," : "") + formVal;
  70. }
  71. MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";
  72.  
  73. if (!MM_abortEdit) {
  74. // execute the insert
  75. var MM_editCmd = Server.CreateObject('ADODB.Command');
  76. MM_editCmd.ActiveConnection = MM_editConnection;
  77. MM_editCmd.CommandText = MM_editQuery;
  78. MM_editCmd.Execute();
  79. MM_editCmd.ActiveConnection.Close();
  80.  
  81. if (MM_editRedirectUrl) {
  82. Response.Redirect(MM_editRedirectUrl);
  83. }
  84. }
  85.  
  86. }
  87. %>
  88. <%
  89. var rsStudioReviewed__MMColParam = "1";
  90. if (String(Request.Form("ParamPhone")) != "undefined" &&
  91. String(Request.Form("ParamPhone")) != "") {
  92. rsStudioReviewed__MMColParam = String(Request.Form("ParamPhone"));
  93. }
  94. %>
  95. <%
  96. var rsStudioReviewed = Server.CreateObject("ADODB.Recordset");
  97. rsStudioReviewed.ActiveConnection = MM_ConnStudio_STRING;
  98. rsStudioReviewed.Source = "SELECT StudioName, Address, City, State, ZipCode, StudioPhoneNumber FROM Studio WHERE StudioPhoneNumber = '"+ rsStudioReviewed__MMColParam.replace(/'/g, "''") + "'";
  99. rsStudioReviewed.CursorType = 0;
  100. rsStudioReviewed.CursorLocation = 2;
  101. rsStudioReviewed.LockType = 1;
  102. rsStudioReviewed.Open();
  103. var rsStudioReviewed_numRows = 0;
  104. %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  105. <html xmlns="http://www.w3.org/1999/xhtml">
  106. <head>
  107. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  108. <title>Submit A Studio Review Form</title>
  109. <style type="text/css">
  110. <!--
  111. body {
  112. background-color: #351100;
  113. }
  114. .style1 {color: #FFFFFF}
  115. .style4 {color: #CCCCCC; }
  116. .style5 {color: #FFFF00; }
  117. .style6 {color: #f5d781}
  118. .style7 {color: #FF0000}
  119. -->
  120. </style>
  121.  
  122. <script type="text/javascript">
  123.  
  124. <!--
  125.  
  126. function validate_form ( )
  127. {
  128. valid = true;
  129.  
  130. if ( document.StudioReviewForm.SubmittedBy.value == "" )
  131. {
  132. alert ( "Please fill in the 'Submitted By' box." );
  133. valid = false;
  134. }
  135.  
  136. if ( ( document.StudioReviewForm.Courteous[0].checked == false ) && ( document.StudioReviewForm.Courteous[1].checked == false ) )
  137. {
  138. alert ( "Please choose your answer to Question 1 by selecting Yes or No" );
  139. valid = false;
  140. }
  141.  
  142. if ( ( document.StudioReviewForm.Knowledgable[0].checked == false ) && ( document.StudioReviewForm.Knowledgable[1].checked == false ) )
  143. {
  144. alert ( "Please choose your answer to Question 2 by selecting Yes or No" );
  145. valid = false;
  146. }
  147.  
  148. if ( ( document.StudioReviewForm.Affordable[0].checked == false ) && ( document.StudioReviewForm.Affordable[1].checked == false ) )
  149. {
  150. alert ( "Please choose your answer to Question 3 by selecting Yes or No" );
  151. valid = false;
  152. }
  153.  
  154. if ( ( document.StudioReviewForm.Sanitary[0].checked == false ) && ( document.StudioReviewForm.Sanitary[1].checked == false ) )
  155. {
  156. alert ( "Please choose your answer to Question 4 by selecting Yes or No" );
  157. valid = false;
  158. }
  159.  
  160. if ( ( document.StudioReviewForm.GoodQualityWork[0].checked == false ) && ( document.StudioReviewForm.GoodQualityWork[1].checked == false ) )
  161. {
  162. alert ( "Please choose your answer to Question 5 by selecting Yes or No" );
  163. valid = false;
  164. }
  165.  
  166.  
  167. if ( document.StudioReviewForm.OverallRating.selectedIndex == 0 )
  168. {
  169. alert ( "Please select your Overall Rating." );
  170. valid = false;
  171. }
  172.  
  173. if ( document.StudioReviewForm.AdditionalComments1.value == "" )
  174. {
  175. alert ( "Please provide additional comments in the comment area." );
  176. valid = false;
  177. }
  178.  
  179.  
  180.  
  181. return valid;
  182. }
  183.  
  184. //-->
  185.  
  186. </script>
  187.  
  188. <script type="text/JavaScript">
  189. <!--
  190. function MM_swapImgRestore() { //v3.0
  191. var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  192. }
  193.  
  194. function MM_preloadImages() { //v3.0
  195. var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  196. var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  197. if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  198. }
  199.  
  200. function MM_findObj(n, d) { //v4.01
  201. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  202. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  203. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  204. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  205. if(!x && d.getElementById) x=d.getElementById(n); return x;
  206. }
  207.  
  208. function MM_swapImage() { //v3.0
  209. var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  210. if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  211. }
  212. //-->
  213. </script>
  214.  
  215. <script>
  216. function limitText(limitField, limitNum) {
  217. if (limitField.value.length > limitNum) {
  218. limitField.value = limitField.value.substring(0, limitNum);
  219. }
  220. }
  221. </script>
  222.  
  223. </head>
  224.  
  225. <body onload="MM_preloadImages('Navigation Buttons/studioreviewsOver.jpg','Navigation Buttons/submitareviewOver.jpg','Navigation Buttons/HomeOver.jpg')">
  226. <table width="750" border="0" align="center">
  227. <tr>
  228. <td colspan="3"><span class="style1"><img src="Images/BannerWIP.png" width="750" height="345" /></span></td>
  229. </tr>
  230. <tr>
  231. <td>&nbsp;</td>
  232. <td>&nbsp;</td>
  233. <td>&nbsp;</td>
  234. </tr>
  235. <tr>
  236. <td colspan="3"><table width="750" border="0">
  237. <tr>
  238. <td width="134" height="299"></td>
  239. <td width="468" bgcolor="#FFFFFF"><img src="WIP Graphics/TribalBordersTop.png" width="477" height="26" /><br />
  240. <table width="479" border="0">
  241. <tr>
  242. <td width="26"><img src="WIP Graphics/TribalBordersLeft3.png" width="26" height="239" /></td>
  243. <td width="413" valign="top" bgcolor="#000000"><p align="center" class="style5"><br />
  244. Welcome To Our Studio Review Form </p>
  245. <p align="center" class="style4"> Please Complete The Review Form Below<br />
  246. Then Click The Submit Buton At The Bottom OF The Form <br />
  247. To Add Your Reveiew To Our Database For:</p>
  248. <table width="410" border="0">
  249. <tr>
  250. <td width="20">&nbsp;</td>
  251. <td width="380"><span class="style7"><%=(rsStudioReviewed.Fields.Item("StudioName").Value)%><br />
  252. <%=(rsStudioReviewed.Fields.Item("Address").Value)%></span><br />
  253. <span class="style7"><%=(rsStudioReviewed.Fields.Item("City").Value)%>, <%=(rsStudioReviewed.Fields.Item("State").Value)%>, <%=(rsStudioReviewed.Fields.Item("ZipCode").Value)%></span><br />
  254. <span class="style7"><%=(rsStudioReviewed.Fields.Item("StudioPhoneNumber").Value)%></span></td>
  255. </tr>
  256. </table> </td>
  257. <td width="26"><img src="WIP Graphics/TribalBordersRight3.png" width="26" height="239" /></td>
  258. </tr>
  259. </table>
  260. <img src="WIP Graphics/TribalBordersBottom.png" width="477" height="26" /></td>
  261. <td width="134"><a href="studioreviews.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('studioreviews','','Navigation Buttons/studioreviewsOver.jpg',1)"><img src="Navigation Buttons/studioreviewsUp.jpg" name="studioreviews" width="134" height="49" border="0" id="studioreviews" /><br />
  262. </a><a href="SubmitAStudioReview.asp" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('submitareview','','Navigation Buttons/submitareviewOver.jpg',1)"><img src="Navigation Buttons/submitareviewUp.jpg" name="submitareview" width="134" height="49" border="0" id="submitareview" /><br />
  263. </a><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','Navigation Buttons/HomeOver.jpg',1)"><img src="Navigation Buttons/HomeUp.jpg" name="Home" width="134" height="49" border="0" id="Home" /></a></td>
  264. </tr>
  265. <tr>
  266. <td>&nbsp;</td>
  267. <td>&nbsp;</td>
  268. <td>&nbsp;</td>
  269. </tr>
  270. </table></td>
  271. </tr>
  272. <tr>
  273. <td height="21" colspan="3"><p>&nbsp;</p>
  274. <form action="<%=MM_editAction%>" METHOD="POST" name="StudioReviewForm" id="StudioReviewForm" onsubmit="return validate form ( );">
  275. <p>&nbsp;</p>
  276. <table width="750" border="0">
  277. <tr>
  278. <td width="418"><span class="style6">Submitted By:
  279. <input name="SubmittedBy" type="text" id="SubmittedBy" size="50" maxlength="50" />
  280. </span></td>
  281. <td colspan="2"><input name="HiddenStudioPhoneNumber" type="hidden" id="HiddenStudioPhoneNumber" value="<%=(rsStudioReviewed.Fields.Item("StudioPhoneNumber").Value)%>" /></td>
  282. </tr>
  283. <tr>
  284. <td colspan="3">&nbsp;</td>
  285. </tr>
  286. <tr>
  287. <td><span class="style6">1.) Were The People You Dealt With Courteous? </span></td>
  288. <td width="159" class="style6"><input name="Courteous" type="radio" value="Yes" />
  289. Yes </td>
  290. <td width="159" class="style6"><input name="Courteous" type="radio" value="No" />
  291. No </td>
  292. </tr>
  293. <tr>
  294. <td>&nbsp;</td>
  295. <td>&nbsp;</td>
  296. <td>&nbsp;</td>
  297. </tr>
  298. <tr>
  299. <td><span class="style6">2.) Was The Staff Knowledgable?</span></td>
  300. <td><span class="style6">
  301. <input name="Knowlegable" type="radio" value="Yes" />
  302. Yes </span></td>
  303. <td><span class="style6">
  304. <input name="Knowlegable" type="radio" value="No" />
  305. No </span></td>
  306. </tr>
  307. <tr>
  308. <td>&nbsp;</td>
  309. <td>&nbsp;</td>
  310. <td>&nbsp;</td>
  311. </tr>
  312. <tr>
  313. <td><span class="style6">3.) Were The Prices Affordable?</span></td>
  314. <td><span class="style6">
  315. <input name="Affordable" type="radio" value="Yes" />
  316. Yes </span></td>
  317. <td><span class="style6">
  318. <input name="Affordable" type="radio" value="No" />
  319. No
  320. </span></td>
  321. </tr>
  322. <tr>
  323. <td>&nbsp;</td>
  324. <td>&nbsp;</td>
  325. <td>&nbsp;</td>
  326. </tr>
  327. <tr>
  328. <td><span class="style6">4.) Did The Studio Have Good Sanitary Conditions?</span></td>
  329. <td><span class="style6">
  330. <input name="Sanitary" type="radio" value="Yes" />
  331. Yes </span></td>
  332. <td><span class="style6">
  333. <input name="Sanitary" type="radio" value="No" />
  334. No</span></td>
  335. </tr>
  336. <tr>
  337. <td>&nbsp;</td>
  338. <td>&nbsp;</td>
  339. <td>&nbsp;</td>
  340. </tr>
  341. <tr>
  342. <td><span class="style6">5.) Was The Quality Of The Work Performed Good?</span></td>
  343. <td><span class="style6">
  344. <input name="GoodQualityWork" type="radio" value="Yes" />
  345. Yes </span></td>
  346. <td><span class="style6">
  347. <input name="GoodQualityWork" type="radio" value="No" />
  348. No</span></td>
  349. </tr>
  350. <tr>
  351. <td>&nbsp;</td>
  352. <td>&nbsp;</td>
  353. <td>&nbsp;</td>
  354. </tr>
  355. <tr>
  356. <td><span class="style6">What Would Be Your Overall Rating Of The Studio?</span></td>
  357. <td colspan="2"><select name="OverallRating" size="1" id="OverallRating">
  358. <option value="">Select A Rating</option>
  359. <option value="1 - Poor">1 - Poor</option>
  360. <option value="2 - Not That Good">2 - Not That Good</option>
  361. <option value="3 - Good">3 - Good</option>
  362. <option value="4 - Very Good">4 - Very Good</option>
  363. <option value="5 - Excellent">5 - Excellent</option>
  364. </select></td>
  365. </tr>
  366. <tr>
  367. <td>&nbsp;</td>
  368. <td>&nbsp;</td>
  369. <td>&nbsp;</td>
  370. </tr>
  371.  
  372. <tr>
  373. <td><span class="style6">Additional Comments: *(Comment Area Has 255 Character Limit)</span></td>
  374. <td>&nbsp;</td>
  375. <td>&nbsp;</td>
  376. </tr>
  377. <tr>
  378. <td><textarea name="AdditionalComments1" cols="55" rows="5" wrap="physical" id="AdditionalComments1" onKeyDown="limitText(this,255);" onKeyUp="limitText(this,255);"></textarea></td>
  379. <td>&nbsp;</td>
  380. <td>&nbsp;</td>
  381. </tr>
  382. <tr>
  383. <td>&nbsp;</td>
  384. <td>&nbsp;</td>
  385. <td>&nbsp;</td>
  386. </tr>
  387. <tr>
  388. <td>&nbsp;</td>
  389. <td>&nbsp;</td>
  390. <td>&nbsp;</td>
  391. </tr>
  392. <tr>
  393. <td>&nbsp;</td>
  394. <td>&nbsp;</td>
  395. <td>&nbsp;</td>
  396. </tr>
  397. <tr>
  398. <td colspan="3"><div align="center">
  399. <input type="image" value="Submit" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Submit','','Navigation Buttons/SubmitOver.jpg',1)" img="img" src="Navigation Buttons/SubmitUp.jpg" name="Submit" width="134" height="49" border="0" id="Submit" />
  400. </div></td>
  401. </tr>
  402. </table>
  403. <p>&nbsp;</p>
  404. <p>&nbsp;</p>
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414. <input type="hidden" name="MM_insert" value="StudioReviewForm">
  415. </form>
  416.  
  417. <p>&nbsp;</p>
  418. <p>&nbsp;</p>
  419. <p>&nbsp;</p>
  420. <p><br />
  421. <br />
  422. </p></td>
  423. </tr>
  424. <tr>
  425. <td>&nbsp;</td>
  426. <td>&nbsp;</td>
  427. <td>&nbsp;</td>
  428. </tr>
  429. </table>
  430. </body>
  431. </html>
  432. <%
  433. rsStudioReviewed.Close();
  434. %>
Last edited by peter_budo; Jun 11th, 2008 at 3:34 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 76
Reputation: anto_nee is an unknown quantity at this point 
Solved Threads: 4
anto_nee anto_nee is offline Offline
Junior Poster in Training

Re: Really Stuck - ASP/Javascript Form Validation

 
0
  #2
Jun 6th, 2008
very big to read
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 4
Reputation: Felipo is an unknown quantity at this point 
Solved Threads: 0
Felipo Felipo is offline Offline
Newbie Poster

Re: Really Stuck - ASP/Javascript Form Validation

 
0
  #3
Jun 6th, 2008
Originally Posted by anto_nee View Post
very big to read
anto_nee -

Sorry about the post being so big to read - I just figured I would list the code in its entirety so it would be clear as to what the page is doing -

I am new to this posting stuff and perhaps I should have just listed the javascrip which handles the form validation and the code which defines the form but then I figured that there may be something in the application (outside of the form definition and javascript validation) which may be causing the conflict or problem and that is why I decided to list all the code -

Do you think that was a wise thing to do -
Also thanks for taking the time to view my problem - Wish I could find a solution fo this - Its driving me crazy -
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 76
Reputation: anto_nee is an unknown quantity at this point 
Solved Threads: 4
anto_nee anto_nee is offline Offline
Junior Poster in Training

Re: Really Stuck - ASP/Javascript Form Validation

 
0
  #4
Jun 7th, 2008
<form action="<%=MM_editAction%>" METHOD="POST" name="StudioReviewForm" id="StudioReviewForm" onsubmit="return validate form ( );">

may be like this

<form action="<%=MM_editAction%>" METHOD="POST" name="StudioReviewForm" id="StudioReviewForm" onsubmit="return validate_form( );">

you might be missing a underscore and a space here..

I couldnt go thru complete code as i am bit busy.. i will try to solve it( if this is not a prob) by tomorrow..

Cheer!!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 4
Reputation: Felipo is an unknown quantity at this point 
Solved Threads: 0
Felipo Felipo is offline Offline
Newbie Poster

Re: Really Stuck - ASP/Javascript Form Validation

 
0
  #5
Jun 8th, 2008
Originally Posted by anto_nee View Post
<form action="<%=MM_editAction%>" METHOD="POST" name="StudioReviewForm" id="StudioReviewForm" onsubmit="return validate form ( );">

may be like this

<form action="<%=MM_editAction%>" METHOD="POST" name="StudioReviewForm" id="StudioReviewForm" onsubmit="return validate_form( );">

you might be missing a underscore and a space here..

I couldnt go thru complete code as i am bit busy.. i will try to solve it( if this is not a prob) by tomorrow..

Cheer!!!
Hi anto_nee -

Your suggetsion with the underscore and the space seems to have solved to the problem - The Javascript is beuing executed when I click the submit button thus the onsubmit is working -

However -

I have a cople of smaller problems now -

The Javascript only works for the first two IF statements - The one for the text box for the Submitted By and the 1st radio button for question 1 with regard to Courteous -

The other radio buttons are ignored and the dropdown list is ignored (but does get flagged on the server side via the MS Access Driver wanting the required field) the text area validation is also ignored -

I try to submit the form when it is entirely blank and the aforesaid occurs - If I satisfy the conditions which are being flagged the form does submit - I am wondering tho as to why the other form elemnts are not getting flagged as errors via the javascript -

I do appreciate your help tho in solving the initial problem with the script not being executed in the first place - The syntax is a killer and I am very surprised that the syntax was not flagged as being incorrect in some way -

If you need me to further explain the problem let me know - I would greatly appreciate it -

Once again thank you so much - I know you are very busy and I do appreciate you taking the time to help me thru this - I am so close tho now to success and it is becasue of you -

Talk to you later - Felipo......
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 76
Reputation: anto_nee is an unknown quantity at this point 
Solved Threads: 4
anto_nee anto_nee is offline Offline
Junior Poster in Training

Re: Really Stuck - ASP/Javascript Form Validation

 
0
  #6
Jun 8th, 2008
Some Spellings missed out..

Knowledgable - Knowlegable..



For dropdown u should use "Value" not "selectindex"

so document.StudioReviewForm.OverallRating.selectedIndex == 0 is wrong

change to
document.StudioReviewForm.OverallRating.value == ""

Change this.. Everything will work..
And too javascript is case sensible..
Take Care..
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 4
Reputation: Felipo is an unknown quantity at this point 
Solved Threads: 0
Felipo Felipo is offline Offline
Newbie Poster

Re: Really Stuck - ASP/Javascript Form Validation

 
0
  #7
Jun 8th, 2008
Originally Posted by anto_nee View Post
Some Spellings missed out..

Knowledgable - Knowlegable..



For dropdown u should use "Value" not "selectindex"

so document.StudioReviewForm.OverallRating.selectedIndex == 0 is wrong

change to
document.StudioReviewForm.OverallRating.value == ""

Change this.. Everything will work..
And too javascript is case sensible..
Take Care..

anto_nee -

The spelling mistake on knowlegable where I had it as knowledable was the culprit - I had left the drop down as "selectedIndex" and it works just fine - If that code was a problem I would have changed it to what you suggested which was "value"

I guess it took a fresh set of eyes to see the problems - I was unaware that Javascript was case sensitive - I am generally a stickler on case sensitivity - My mistakes were obviosuly careless and I should have taken more time to re-check and ensure the typographical errors - the syntax issue with the missing underscore was an oversight due to my inexperience in javascript -

You truly are the man!!! I can't thank you enough for the time you took out to help me with this problem -

If I run into any other problem with this tho I will let you know - but it all looks good thus far -

Again Thank You very very much for the help - I appreciate it -

How do I let this forum know that the problem has been solved and to let the forum know it was becasue you solved it - I would love to give vredit where credit is due -

Talk to you later.....Felipo -
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC