Checkform

I am using struts and want to use javascript to validate the values put into the
form. so far its not working properly.
Thanks ahead.
<%@ taglib uri = "http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri = "http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri = "http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<html>
<body>
<html:form action="/sendPhone" method="post">
<table>
<tr>
wfff wertyi5 <td >Name:</td>
<td><html:text property="phone"/></td>
</tr>
</table>
<input type="submit" onclick="javascript:doSomeFunction()"/>
</html:form>
<SCRIPT language="JavaScript" type="text/javascript">
function doSomeFunction(){
form[0].submit();//This line can be taken out and the form still submits I dont want this to happen.
</script>
</body>
</html>

Greetings,
As mentioned you probably want to move it to the form tag and double check a few things.
Lets say your function call is
onSubmit="return Verify(formName)"
Remember that if it evaluates to false it will not submit but if it evaluates to true it will.
Make sure your function definition returns the right value.
Hope that helps some,
-J

Similar Messages

  • Template is nested inside itself (directly or indirectly)

    Hello helpful folks of the Forum.  
    I had a template (test.dwt) based on which 60 of my pages are built and I dont know what happened now that whenever I try to update, all the editable contents of the 60 pages gets deleted.  I was getting an error "template is nested inside itself (directly or indirectly)
    Can someone please take a look at the template and let me know what is wrong and how I can fix it.   If I create a similar tempalte and name it test.dwt, will it work ?    Thanks for your help.
    <!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=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Welcome to Sringeri Vidya Bharati Foundation (Canada)</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
    <meta name="SVBF" content="SVBF, Sringeri Temple, Sringeri Vidya Bharati Foundation, Sharadamba Temple, Ganesha, Hanuman, Hanuman Chalisa, Sathyanarayana Pooja, Shasti Bhajans, Brydon Drive, Sringeri, " />
    <title></title>
    <style type="text/css">
    <!--
    .style28 {
              font-size: 36px;
              font-weight: bold;
    .style49 {
              font-weight: normal;
              font-family: Cambria;
              font-size: 14px;
    -->
    </style>
    <style type="text/css">
    <!--
    p.MsoNormal {
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:10.0pt;
    margin-left:0cm;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    -->
    </style>
    <script language="javascript" type="text/javascript">
    <!--
         Author: Eric King
         Url: http://redrival.com/eak/index.shtml
         This script is free to use as long as this info is left in
         Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
    var win=null;
    function NewWindow(mypage,myname,w,h,scroll,pos){
    if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):1 00;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.h eight)?(screen.height-h)/2:100;}
    else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+ scroll+',location=yes,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';
    win=window.open(mypage,myname,settings);}
    // -->
    </script>
    <script type="text/javascript" src="http://svbfcanada.com/SVBF/jsmenu/stmenu.js"></script>
    <style type="text/css">
    <!--
    .style1 {
              color: #FFFFFF;
              font-size: 12px;
              font-family: Cambria;
              font-weight: bold;
    .style2 {
              color: #FFFFFF;
              font-size: 14px;
              font-family: Cambria;
              font-weight: bold;
    .style3 {color: #CCCCCC}
    body {
              background-color: #FFFFCC;
    .style6 {
              font-size: 12px;
              font-family: Verdana, Arial, Helvetica, sans-serif;
    .border1 {
              border: 1px solid #000000;
    .style11 {color: #000000}
    .style12 {color: #FFFFFF}
    .style13 {font-weight: bold}
    .style14 {font-size: 14px}
    .BG1 {
              background-image: url(http://www.svbfcanada.com/SVBF/images/BG1.jpg);
              background-repeat: no-repeat;
    .style15 {font-size: 12px}
    .style17 {
              font-size: 16px;
              font-weight: bold;
              font-family: Cambria;
    .style19 {font-size: 16px}
    .style21 {font-weight: bold}
    -->
    </style>
    </script>
    <script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    <script language="JavaScript1.1">
    <!--
    //Pixelating Image slideshow
    //Copyright Dynamic Drive 2001
    //Visit http://www.dynamicdrive.com for this script
    //specify interval between slide (in mili seconds)
    var slidespeed=3000
    //specify images
    var slideimages=new Array("http://www.svbfcanada.com/SVBF/images/Navara2012.jpg","http://www.svbfcanada.com/SVBF/images/diwalidance.JPG","http://www.svbfcanada.com/SVBF/images/sivarathri.jpg","http://www.svbfcanada.com/SVBF/images/navarathri2011.JPG", "http://www.svbfcanada.com/SVBF/images/AbdulKalam.JPG","http://www.svbfcanada.com/SVBF/images/narasimhajayanti.JPG")
    //specify corresponding links
    var slidelinks=new Array("http://www.svbfcanada.com/SVBF/photogallery.html")
    var imageholder=new Array()
    var ie55=window.createPopup
    for (i=0;i<slideimages.length;i++){
    imageholder[i]=new Image()
    imageholder[i].src=slideimages[i]
    function gotoshow(){
    window.location=slidelinks[whichlink]
    //-->
    </script>
    <style type="text/css">
    .menutitle{
              cursor:pointer;
              margin-bottom: 5px;
              background-color:#ECECFF;
              color:#000000;
              width:306px;
              padding:2px;
              text-align:center;
              font-weight:bold;
              /*/*/border:1px solid #000000;/* */
    .submenu{
    margin-bottom: 0.5em;
    .style22 {font-weight: bold}
    .style23 {font-family: Cambria}
    .style28 {
              font-size: 18px;
              font-weight: bold;
              font-family: Cambria;
    </style>
    <script type="text/javascript">
    * Switch Menu script- by Martial B of http://getElementById.com/
    * Modified by Dynamic Drive for format & NS4/IE4 compatibility
    * Visit http://www.dynamicdrive.com/ for full source code
    var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
    var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
    if (document.getElementById){ //DynamicDrive.com change
    document.write('<style type="text/css">\n')
    document.write('.submenu{display: none;}\n')
    document.write('</style>\n')
    function SwitchMenu(obj){
              if(document.getElementById){
              var el = document.getElementById(obj);
              var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
                        if(el.style.display != "block"){ //DynamicDrive.com change
                                  for (var i=0; i<ar.length; i++){
                                            if (ar[i].className=="submenu") //DynamicDrive.com change
                                            ar[i].style.display = "none";
                                  el.style.display = "block";
                        }else{
                                  el.style.display = "none";
    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset);
    if (end == -1) end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    return returnvalue;
    function onloadfunction(){
    if (persistmenu=="yes"){
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=get_cookie(cookiename)
    if (cookievalue!="")
    document.getElementById(cookievalue).style.display="block"
    function savemenustate(){
    var inc=1, blockid=""
    while (document.getElementById("sub"+inc)){
    if (document.getElementById("sub"+inc).style.display=="block"){
    blockid="sub"+inc
    break
    inc++
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
    document.cookie=cookiename+"="+cookievalue
    if (window.addEventListener)
    window.addEventListener("load", onloadfunction, false)
    else if (window.attachEvent)
    window.attachEvent("onload", onloadfunction)
    else if (document.getElementById)
    window.onload=onloadfunction
    if (persistmenu=="yes" && document.getElementById)
    window.onunload=savemenustate
    </script>
    </head>
    <body>
    <center>
    <script language=JavaScript>
    <!--
    //Disable right click script III- By Renigade ([email protected])
    //For full source code, visit http://www.dynamicdrive.com
    var message="";
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    document.oncontextmenu=new Function("return false")
    // -->
    </script>
    <table width="1092" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
      <!--DWLayoutTable-->
      <tr>
        <td height="57" colspan="8" valign="top" bgcolor="D69306"><p align="right"><script language="JavaScript">
    var now = new Date();
    var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    var months = new Array('January','February','March','April','May','June','July','August','September','Octo ber','November','December');
    var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
    function fourdigits(number)          {
              return (number < 1000) ? number + 1900 : number;
    today =  days[now.getDay()] + ", " +
                  months[now.getMonth()] + " " +
                   date + ", " +
                    (fourdigits(now.getYear())) ;
    document.write("" +today+ ".");
    </script> </p>      <p align="center"><script type="text/javascript" src="http://www.svbfcanada.com/SVBF/jsmenu/svbfcanada.js"></script>
          </p></td>
        </tr>
      <tr>
        <td height="210" colspan="8" valign="top" bgcolor="#d69306"><img src="http://www.svbfcanada.com/SVBF/images/SVBFBanner2.jpg" width="1092" height="210" /></td>
        </tr>
      <tr>
        <td width="43" rowspan="8" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="44" height="1181"> </td>
              </tr>
        </table></td>
        <td width="4" height="17"></td>
        <td colspan="2" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
          <!--DWLayoutTable-->
          <tr>
            <td width="321" height="1150" valign="top" bgcolor="#CC9933"><div style="margin-top: -25px;  "Important days at the temple this month.">
              <p align="center" class="style19" style="background: #CC9933; color: #2D251E; margin: 5px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><br />
                <strong><span class="style21"><u>            TEMPLE TIMINGS</u></span><BR/>
                  <span class="style22">WEEKDAYS</span></strong><br />
                8.30 am to 11.30 am<br />
                4.30 pm to 8.30 pm<br/>
                <strong>WEEKENDS</span></strong><br />
                8.30 am to 8.30 pm<br />
                <span class="style14"><br />
                </span></p>
              <div style="margin-top: -25px;  "important="Important" days="days" at="at" the="the" temple="temple" this="this" month.="month."">
                      <p align="center" class="style14" style="background: #CC3333; color: #FFFFFF; margin: 5px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><u><strong>IMPORTANT DATES THIS MONTH</strong></u></p>
                      <p align="left" class="style23 style19" style="background: #CC9933; color: #2D251E; margin: 0px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><strong>
                      05</strong> Papa Vimochana Ekadasi<br />
                       <strong>06 </strong>Pradosham<br />
                       <strong>10</strong> Vaisaka Masam Begins<br />
                      <strong>
                      12</strong> Akshaya Truteya<br />
                      <strong>14</strong> Ramanuja Jayanthi<br />
                      <strong>15</strong> Shankara Jayanthi<br>
                       <strong>18</strong> Hanuman Chalisa<br />
                        <strong>21</strong> Mohini Ekadasi<br>
                        <strong>22</strong> Pradosham<br />
                        <strong>23</strong> Narasimha Jayanthi<br />
                        <strong>24</strong> Sathyanarayana Pooja<br />
                        <strong>27 </strong>Sankatahara Chaturthi</p>
                      <p align="center" class="style28" style="background: #CC9933; color: #2D251E; margin: 0px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><a href="http://www.svbfcanada.com/SVBF/SearchSVBF.html"><img src="http://www.svbfcanada.com/SVBF/images/SearchSVBF.jpg" width="200" height="70" border="0" /></a></p>
                      <p align="center" class="style15" style="background: #CC9933; color: #2D251E; margin: 0px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><span class="style19"><a href="http://www.svbfcanada.com/SVBF/Support.html"><img src="http://www.svbfcanada.com/SVBF/images/donate.jpg" width="285" height="140" Border="0"/></a></span></p>
                      <p align="left" class="style15" style="background: #CC9933; color: #2D251E; margin: 0px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><a href="http://www.svbfcanada.com/SVBF/Directions.html"><img src="http://www.svbfcanada.com/SVBF/images/Directions.jpg" width="305" height="60" border="0" /></a></p>
                      <p align="center" class="style19" style="background: #CC9933; color: #2D251E; margin: 0px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><span class="style17 style23 style22"><span class="style11">Visit our</span> <a href="http://www.svbfcanada.com/SVBF/photogallery.html" class="style6">Photo Gallery</a></span>
                        <script language="JavaScript1.1" type="text/javascript">
    <!--
    var whichlink=0
    var whichimage=0
    var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0
    function slideit(){
    if (!document.images) return
    if (ie55) document.images.slide.filters[0].apply()
    document.images.slide.src=imageholder[whichimage].src
    if (ie55) document.images.slide.filters[0].play()
    whichlink=whichimage
    whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
    setTimeout("slideit()",slidespeed+pixeldelay)
    slideit()
    //-->
                            </script>
                      </p>
                      <div align="center"></div>
                      <div align="center"></div>
                      <p align="left" class="style15" style="background: #CC9933; color: #2D251E; margin: 0px 0px 0px 0px; padding: 5px; border: solid #75614F; border-width: 1px 1px 1px 1px;"><a href="http://www.svbfcanada.com/SVBF/photogallery.html"><img src="http://www.svbfcanada.com/SVBF/images/diwalidance.JPG" name="slide" width="306" height="200" border="0" style="filter:progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=15,Duration=1)" color="Black" /></a></p>
    <form id="form3" action="../SVBF/response.php" method="post" onsubmit="return checkform(this);">
                                         <fieldset>
                                         <legend><span class="style23 style12"><strong>Subscribe to our Newslette</strong></span><span class="style12">r</span></legend>
          <p class="first">
            <label for="name">Name</label>
            <input type="text" name="name" id="name" size="30" />
            </p>
          <p>
            <label for="email">Email </label>
            <input type="text" name="email" id="email" size="30" />
          </p>
          <p>
              <label for="code">Enter code below > <span class="style19" id="txtCaptchaDiv" style="color:#000066"><strong></strong></span><!-- this is where the script will place the generated code -->
                <input type="hidden" id="txtCaptcha" /></label><!-- this is where the script will place a copy of the code for validation: this is a hidden field -->
              <input type="text" name="txtInput" id="txtInput" size="30" />
              </p>
              <p class="submit">
                <button type="submit">Send</button>
              </p>
              <div align="center"></div>
              <div align="center">
                <script type="text/javascript">
              function checkform(theform){
                        var why = "";
                        if(theform.txtInput.value == ""){
                                  why += "- Security code should not be empty.\n";
                        if(theform.txtInput.value != ""){
                                  if(ValidCaptcha(theform.txtInput.value) == false){
                                            why += "- Security code did not match.\n";
                        if(why != ""){
                                  alert(why);
                                  return false;
    //Generates the captcha function   
              var a = Math.ceil(Math.random() * 9)+ '';
              var b = Math.ceil(Math.random() * 9)+ '';      
              var c = Math.ceil(Math.random() * 9)+ ''; 
              var d = Math.ceil(Math.random() * 9)+ ''; 
              var e = Math.ceil(Math.random() * 9)+ ''; 
              var code = a + b + c + d + e;
              document.getElementById("txtCaptcha").value = code;
              document.getElementById("txtCaptchaDiv").innerHTML = code;
    // Validate the Entered input aganist the generated security code function  
    function ValidCaptcha(){
              var str1 = removeSpaces(document.getElementById('txtCaptcha').value);
              var str2 = removeSpaces(document.getElementById('txtInput').value);
              if (str1 == str2){
                        return true;
              }else{
                        return false;
    // Remove the spaces from the entered and generated code
    function removeSpaces(string){
              return string.split(' ').join('');
              </script>
                <span class="style12 style23 style15">Subscribe to our Newsletter to   receive updates on happenings at the Temple and the Community Hall </span><br />
              </div>
              <div align="center" class="style12"><small style="text-align:center">reload the page to change the code</small></div>
              </fieldset>
        </form>
                    </div>
                </div></td>
              </tr>
          <tr>
            <td height="152" valign="top" bgcolor="cc9933"><div align="center">
              <p><a href="http://www.tattvaloka.com/"><img src="http://www.svbfcanada.com/SVBF/images/Tattvaloka.jpg" width="306" height="160" border="0" /></a></p>
              <p><a href="http://www.svbfcanada.com/SVBF/TouristToronto.html"><img src="http://www.svbfcanada.com/SVBF/images/TORONTO.jpg" width="306" height="200" border="0" /></a></p>
            </div></td>
          </tr>
        </table></td>
        <td width="43"></td>
        <td width="635"></td>
        <td width="9"></td>
        <td width="37"></td>
      </tr>
      <tr>
        <td height="1410"></td>
        <td></td>
        <td rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="640" height="1471" valign="top">
              <div align="center"></div>          <div align="center" class="style49">
                <p> </p>
                  <p><a href="http://www.svbfcanada.com/SVBF/SathyanarayanaPooja.html"></a></p>
                <a href="http://www.svbfcanada.com/SVBF/SathyanarayanaPooja.html"><a href="http://www.svbfcanada.com/SVBF/SathyanarayanaPooja.html"><a href="http://www.svbfcanada.com/SVBF/SathyanarayanaPooja.html"></a></div></td>
              </tr>
          <tr>
            <td height="106"></td>
            </tr>
        </table></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="167"></td>
        <td colspan="2" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="318" height="159" valign="top"><div align="center">
              <p><a href="http://www.sringeri.net"><img src="http://www.svbfcanada.com/SVBF/images/sringerinet.jpg" width="306" height="92" border="0" /></a><a href="http://www.svbf.org"><img src="http://www.svbfcanada.com/SVBF/images/svbfusa.jpg" width="306" height="49" border="0" /></a>
                <iframe src="https://www.google.com/calendar/embed?title=SVBF%20Canada%20Calendar&mode=AGENDA&height=30 0&wkst=1&bgcolor=%23cccccc&src=calendarsvbf%40gmail.com&color=%232952A3&ctz=America%2FToro nto" style=" border:solid 1px #777 " width="310" height="300" frameborder="0" scrolling="yes"></iframe>
                <!-- AddThis Button BEGIN -->
    </p>
              <p></p></td>
              </tr>
        </table></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="319"></td>
        <td></td>
        <td> </td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="19"></td>
        <td width="312"> </td>
        <td width="9"></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="20"></td>
        <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="311" height="19" valign="top"><div align="center">
              <p><span class="style17 style23 style22 style3">Visit our Photo Gallery</span>
                <span class="style3">
                  <script language="JavaScript1.1">
    <!--
    var whichlink=0
    var whichimage=0
    var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0
    function slideit(){
    if (!document.images) return
    if (ie55) document.images.slide.filters[0].apply()
    document.images.slide.src=imageholder[whichimage].src
    if (ie55) document.images.slide.filters[0].play()
    whichlink=whichimage
    whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
    setTimeout("slideit()",slidespeed+pixeldelay)
    slideit()
    //-->
                      </script>
                  </span></p>
                </div></td>
              </tr>
          <tr>
            <td height="1"></td>
              </tr>
        </table></td>
        <td> </td>
        <td> </td>
        <td> </td>
        <td> </td>
        <td> </td>
      </tr>
      <tr>
        <td height="3"></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="113" colspan="6" valign="top" bgcolor="#6C0F17"><div align="center">
                  <p class="style11 style2"><span class="style12">Sringeri Vidya Bharati Foundation (Canada)<br />
                  80 Brydon Dr., Etobicoke, ON, M9W 4N6 Phone: 416-745-1010<br />
                  Questions or Comments about this website ?
            Email the</span><span class="style12"> <a href="mailto:[email protected]" class="style14 style3">Web Master</a><br />
                    <a href="http://www.svbfcanada.com/SVBF/Disclaimer.php" class="style13 style3">Disclaimer</a> </span></p>
                  <p class="style11"><span class="style1">Copyright © 2008 – 2012 by Sringeri Vidya Bharati Foundation (Canada) All Rights   Reserved.</span><br />
                        <a href="http://www.copyscape.com/plagiarism-finder/"><img src="http://www.svbfcanada.com/SVBF/images/cs-ye-234x16.gif" width="234" height="16" border="0" /></a><br />
            </p>
          </div></td>
      <td> </td>
      </tr>
    </table>
    </td></center>
    </body>
    </html>

    This will happen if you mistakenly save a Child page as a Template.dwt and overwrite your original Template file. Do you have a backup of your original Template stored some place safe?
    In the future, when you have questions related to Dreamweaver, use the Dreamweaver Forum. You'll get better, quicker answers there.
    http://forums.adobe.com/community/dreamweaver?view=discussions
    Nancy O.

  • How to properly order form data?

    I have a form to collect data for a price quote (printing & direct mail).  When I convert the collected data to a .CSV file, the data is not in the same order.  How do i tell my form to postback data in the same order?
    Here is the code (this site would not allow me to attach the files, for whatever reason)
    quote.html . . . the quote form
    <script language=JavaScript>
    function checkform(what){
        if (what.Company_Name.value==''){ alert('You must provide your company name.'); return false;}
        else if (what.Contact_Name.value==''){ alert('You must provide your contact name.'); return false;}
        else if (what.Contact_Email.value==''){ alert('You must provide your e-mail address.'); return false;}
        else{ return true; }
    </script>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
    <SCRIPT language=JavaScript src="file:///C|/Documents and Settings/michael/Desktop/images/franklin_java.js"></SCRIPT>
    <META http-equiv=Content-Type content="text/html; charset=iso-8859-1" />
    <META content=2.0 name=Version />
    <META content="MSHTML 6.00.2600.0" name=GENERATOR />
    <script type="text/JavaScript">
    <!--
    </HEAD>
    <BODY bgColor=#3c4676 text=#000000 link=#000000 vLink=#000000 aLink=#000000
    leftMargin=0 topMargin=0
    marginwidth="0" >
    <!-- InstanceBeginEditable name="EditRegion5" --><script language=JavaScript>
    function checkform(what){
        if (what.Company_Name.value==''){ alert('You must provide your company name.'); return false;}
        else if (what.Contact_Name.value==''){ alert('You must provide your contact name.'); return false;}
        else if (what.Contact_Email.value==''){ alert('You must provide your e-mail address.'); return false;}
        else{ return true; }
    </script>
    <style type="text/css">
    <!--
    .style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; }
    .style4 {font-size: small}
    .style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; font-weight: bold; }
    .style12 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; color: #000000; }
    body {
        background-color: #006666;
    .style13 {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-weight: bold;
        font-size: 14px;
    body,td,th {
        font-size: 10px;
    .style15 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
    .style16 {
        color: #000000
    -->
    </style>
    <form method="post" onSubmit="return checkform(this)" action="aspform.asp">
    <INPUT TYPE=HIDDEN NAME="to" VALUE="[email protected]">
    <INPUT TYPE=HIDDEN NAME="subject" VALUE="Franklin Request a Quote Form">
    <INPUT TYPE=HIDDEN NAME="print_blank_fields" VALUE="1"><br><br>
    <table width = "800" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
    <tr>
    </tr>
    <tr>
    <td width="125" align="right" ><span class="style12">Company Name:</span></td>
    <td><INPUT NAME="Company_Name" TYPE="text" VALUE="" SIZE=30 MAXLENGTH=50></td>
    </tr>
    <tr>
    <td width="125" align="right" ><span class="style12">Contact Name:</span></td>
    <td><INPUT NAME="Contact_Name" TYPE="text" VALUE="" SIZE=30 MAXLENGTH=50></td>
    </tr>
    <tr>
    <td width="125" align="right" ><span class="style12">Contact Email:</span></td>
    <td><INPUT NAME="Contact_Email" TYPE="text" VALUE="" SIZE=30 MAXLENGTH=50></td>
    </tr>
    </table>
    <table width = "800" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
    <tr>
    <td width  = "125" align="right"><span class="style3">Date estimate needed:</span></td>
    <td width="112"><select name="Date_estimate_needed" size="1">
    <option value="">:: Month ::</option>
    <option value="JAN">JAN</option>
    <option value="FEB">FEB</option>
    <option value="MARCH">MARCH</option>
    <option value="APRIL">APRIL</option>
    <option value="MAY">MAY</option>
    <option value="JUNE">JUNE</option>
    <option value="JULY">JULY</option>
    <option value="AUG">AUG</option>
    <option value="SEPT">SEPT</option>
    <option value="OCT">OCT</option>
    <option value="NOV">NOV</option>
    <option value="DEC">DEC</option>
    </select></td>
    <td width="95"><select name="Date_estimate_needed" size="1">
    <option value="">:: Date ::</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select></td>
    <td width="447"><select name="Date_estimate_needed" size="1">
    <option value="">:: Year ::</option>
    <option value="2009">2009</option>
    <option value="2010">2010</option>
    </select></td>
    </tr>
    </table>
    <table width="800" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
      <tr>
        <td width = "162" align="right" valign="top"><span class="style4"></span></td>
        <td width="525"> </td>
      </tr>
      <tr>
        <td align="right" valign="top"><span class="style4"></span><span class="style3">Please Select Product Type(s):</span></td>
        <td><span class="style3">
          <input type="checkbox" name="Self Mailer" id="Self Mailer">
          <label for="Self Mailer">Self Mailer</label>
          <label>
          <input type="checkbox" name="Postcard" id="Postcard">
    Postcard</label>
          <label>
          <input type="checkbox" name="Booklet" id="Booklet">
    Booklet</label>
        </span>
          <p class="style3">
            <label></label>
            <label>
    <input type="checkbox" name="Envelope" id="Envelope">
    Envelope</label>
            <label>
    <input type="checkbox" name="Invitation" id="Invtiation">
    Invitation</label>
    <label>
    <input type="checkbox" name="Other" id="Other">
    Other</label>
    </p>
          <p class="style3">
            <label></label>
          </p>      </td>
      </tr>
      <tr>
        <td align="right" valign="top"><span class="style3">Number of Versions</span></td>
        <td><table width="507">
          <tr>
            <td width="499"><label>
              <span class="style15">
              <input type="radio" name="RadioGroup1" value="1" id="RadioGroup1_0">
              1
              <input type="radio" name="RadioGroup1" value="2" id="RadioGroup1_1">
    2
    <input type="radio" name="RadioGroup1" value="3" id="RadioGroup1_2">
    3
    <input type="radio" name="RadioGroup1" value="4" id="RadioGroup1_3">
    4
    <input type="radio" name="RadioGroup1" value="5" id="RadioGroup1_4">
    5
    <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_5">
              </span><span class="style3">Other
    - Specify</span>
    <input name="Specify" type="text" id="Specify" size="5" maxlength="3">
    </label></td>
          </tr>
        </table>     
          <p class="style3">Are the version Quantities the same?
            <label>
            <input type="radio" name="RadioGroup3" value="Yes" id="RadioGroup3_0">
    Yes</label>
            <input type="radio" name="RadioGroup3" value="No" id="RadioGroup3_1">
            No<br>
            <label></label>
    </p>
          <p>
            <label></label>
            <br>
          </p></td>
      </tr>
      <tr>
        <td width="162" align="right" ><span class="style3">Total Quantity:</span></td>
        <td><input name="Quantity" type="text" value="" size=30 maxlength=50></td>
      </tr>
      <tr>
        <td width="162" align="right" -><span class="style3">Flat Size:</span></td>
        <td><input name="Flat_Size" type="text" value="" size=30 maxlength=50></td>
      </tr>
      <tr>
        <td width="162" align="right" -><span class="style3">Finished/Folded Size:</span></td>
        <td><input name="Finished/Folded_Size:" type="text" value="" size=30 maxlength=50></td>
      </tr>
      <tr>
        <td width="162" align="right" -><span class="style3">Number of Pages:</span></td>
        <td><INPUT NAME="Number_of_Pages" TYPE="text" VALUE="" SIZE=30 MAXLENGTH=50></td>
    </tr>
    <tr>
    <td><div align="right"><span class="style3">Envelope Size #1:</span></div></td>
    <td><label>
      <input type="text" name="textfield" id="textfield">
    </label></td>
    </tr>
    <tr>
      <td><div align="right"><span class="style3">Envelope Size #2:</span></div></td>
      <td><input type="text" name="textfield2" id="textfield2"></td>
    </tr>
    <tr>
      <td><div align="right"><span class="style3">If Booklet</span></div></td>
      <td><table width="351">
        <tr>
          <td valign="middle"><label>
            <span class="style3">
            <input type="radio" name="RadioGroup2" value="Self-Cover" id="RadioGroup2_0">
            Self-Cover</span></label>        <span class="style3">
            <label>
            <input type="radio" name="RadioGroup2" value="Plus Cover" id="RadioGroup2_1">
            Plus Cover</label>
            </span>        <label></label></td>
        </tr>
      </table>  </td>
    </tr>
    </table>
    <table width = "800" border = "0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
    <tr>
    <td width = "125" align="right" valign="top"><span class="style3">Size Notes:</span></td>
    <td><TEXTAREA cols=23 name="Size_Notes" rows=4 wrap=virtual></TEXTAREA></td>
    </tr>
    </table>
    <table width = "800" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
    <tr>
    <td width = "125" align="right" ><span class="style3">Proof Required:</span></td>
    <td colspan="4"><select name="Proof_Required" size="1">
    <option value="">:: Select One ::</option>
    <option value="Laser">Laser</option>
    <option value="Color_Laser">Color Laser</option>
    <option value="Epson_(relative color match)">Epson (relative color match)</option>
    <option value="Digital_Matchprint_(exact color match)">Digital Matchprint (exact color match)</option>
    <option value="PDF">PDF</option>
    </select></td>
    </tr>
    <tr>
      <td colspan="5" align="right" ><div align="left">
        <blockquote>
          <p><span class="style7">Paper Specs:</span></p>
        </blockquote>
      </div></td>
      </tr>
    </table>
    <table width = "800" border = "0" align="center" cellpadding = "2" cellspacing="2" bgcolor="#FFFFFF">
      <tr>
        <td width = "125" align="right"><span class="style3">Paper:</span></td>
        <td width="88" align="center"><span class="style3">Color</span></td>
        <td width="84" align="center"><span class="style3">Weight</span></td>
        <td width="84" align="center"><span class="style3">Type</span></td>
        <td width="556" align="center"><div align="left"><span class="style3">Finish</span></div></td>
      </tr>
      <tr>
        <td align="right" class="style3">Self Mailer:</td>
        <td align="center"><div align="left">
          <input name="Postcard Color2" type="text" id="Self Mailer" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
          <input name="Postcard Weight2" type="text" id="Self Mailer Weight" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
          <input name="Postcard Type" type="text" id="Self Mailer Type" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
          <input name="Postcard Finish2" type="text" id="Self Mailer Finish" size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right" class="style3">Postcard:</td>
        <td align="center"><div align="left">
            <input name="Postcard Color" type="text" id="Postcard Color" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
            <input name="Postcard Weight" type="text" id="Postcard Weight" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
            <input name="Postcard Type Weight" type="text" id="Postcard Type" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
            <input name="Postcard Finish" type="text" id="Postcard Finish" size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right" class="style3">Invitation:</td>
        <td align="center"><div align="left">
            <input name="Invitation Color" type="text" id="Invitation Color" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
            <input name="Invitation Weight" type="text" id="Invitation Weight" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
            <input name="Invitation Type" type="text" id="Invitation Type" size="10" maxlength="10">
        </div></td>
        <td align="center"><div align="left">
            <input name="Self Mailer Finish2" type="text" id="Self Mailer Finish" size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right"><span class="style3">Envelope #1</span></td>
        <td><span class="style4">
          <input name="Cover_Color" type="text" value="" size=10 maxlength=50>
        </span></td>
        <td><input name="Cover_Color" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Cover_Color" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Cover_Color" type="text" value="" size=10 maxlength=50></td>
      </tr>
      <tr>
        <td align="right"><span class="style3">Envelope #2</span></td>
      </tr>
      <tr>
        <td width = "125" align="right"><span class="style3">Cover (If booklet):</span></td>
        <td><input name="Cover_Color" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Cover_Weight" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Cover_Brand" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Cover_Finish" type="text" value="" size=10 maxlength=50></td>
      </tr>
      <tr>
        <td width = "125" align="right"><span class="style3">Inside Pages:</span></td>
        <td><input name="Inside_Pages_Color" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Inside_Pages_Weight" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Inside_Pages_Brand" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Inside_Pages_Finish" type="text" value="" size=10 maxlength=50></td>
      </tr>
      <tr>
        <td align="right" class="style3">Other:</td>
        <td colspan="4"><label>
          <textarea name="Other2" id="Other2" cols="45" rows="5"></textarea>
        </label></td>
      </tr>
      <tr>
        <td width = "125" align="right" valign="top"><span class="style3">Paper Notes:</span></td>
        <td colspan="4"><span class="style3">
          <textarea cols=23 name="Paper_Notes" rows=4 wrap=virtual></textarea>
        </span></td>
      </tr>
      <tr>
        <td colspan="3" align="right" ><div align="left">
            <blockquote>
              <p><span class="style7">Ink Specs:</span></p>
            </blockquote>
        </div></td>
      </tr>
      <tr>
        <td width = "125" align="right" ><span class="style3">Ink:</span></td>
        <td align="center" valign="bottom"><span class="style3">Front</span></td>
        <td align="center" valign="bottom"><span class="style3">Back</span></td>
      </tr>
      <tr>
        <td align="right" ><span class="style3">Self Mailer</span></td>
        <td align="center" valign="bottom"><label>
          <div align="left">
            <input name="Self Mailer Ink Front" type="text" id="Self Mailer Ink Front" value="4" size="10" maxlength="10">
            </div>
        </label></td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front2" type="text" id="Self Mailer Ink Back" value="4" size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right" class="style3" >Postcard</td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front3" type="text" id="Postcard Ink Front" value="4" size="10" maxlength="10">
        </div></td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front4" type="text" id="Postcard Ink Back" value="4" size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right" class="style3" >Invitation</td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front5" type="text" id="Invitation Ink Front" value="4" size="10" maxlength="10">
        </div></td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front6" type="text" id="Invitation Ink Back" value=" " size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right" class="style3" >Envelope #1</td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front7" type="text" id="Envelope #1 Ink Front" value="4" size="10" maxlength="10">
        </div></td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front8" type="text" id="Envelope #1 Ink Back" value=" " size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td align="right" class="style3" >Envelope #2</td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front9" type="text" id="Envelope #2 Ink Front" value="4" size="10" maxlength="10">
        </div></td>
        <td align="center" valign="bottom"><div align="left">
          <input name="Self Mailer Ink Front10" type="text" id="Envelope #2 Ink Front" value=" " size="10" maxlength="10">
        </div></td>
      </tr>
      <tr>
        <td width = "125" align="right"><span class="style3">Cover (If booklet):</span></td>
        <td><input name="Ink_Cover_Front" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Ink_Cover_Back" type="text" value="" size=10 maxlength=50></td>
      </tr>
      <tr>
        <td width = "125" align="right"><span class="style3">Inside Pages:</span></td>
        <td><input name="Ink_Inside_Pages_Front" type="text" value="" size=10 maxlength=50></td>
        <td><input name="Ink_Inside_Pages_Back" type="text" value="" size=10 maxlength=50></td>
      </tr>
      <tr>
        <td width = "125" align="right" valign="top"><span class="style3">Ink notes: <br>
          (note if heavy coverage)</span></td>
        <td colspan="4"><span class="style3">
          <textarea cols=23 name="Ink_Notes" rows=4 wrap=virtual></textarea>
        </span></td>
      </tr>
      <tr>
        <td colspan="5" align="right"><div align="left" class="style7">
            <blockquote>
              <p>Bindery &amp; Mailing Specs:</p>
            </blockquote>
        </div></td>
      </tr>
      <tr>
        <td width = "125" align="right"><span class="style3">Bindery:</span></td>
        <td colspan="4"><span class="style3">
          <select name="Binary" size="1">
            <option value="">:: Select One ::</option>
            <option value="Trim">Trim</option>
            <option value="Fold">Fold</option>
            <option value="Score">Score</option>
            <option value="Perforate">Perforate</option>
            <option value="Saddle-Stitch">Saddle-Stitch</option>
            <option value="Perfect Bind">Perfect Bind</option>
            <option value="Drill">Drill</option>
            <option value="Die Cut">Die Cut</option>
            <option value="Glue">Glue</option>
            <option value="Other">Other</option>
          </select>
        </span></td>
      </tr>
      <tr>
        <td  align="right"><span class="style3">Personalization: </span></td>
        <td colspan="4"><label><span class="style3">
          <input type="checkbox" name="Simplex Laser" id="Simplex Laser">
          Simplex Laser
          <input type="checkbox" name="Duplex Laser" id="Duplex Laser">
          Duplex Laser
          <input type="checkbox" name="Inkjet" id="Inkjet">
          Inkjet
          <input type="checkbox" name="Indigo" id="Indigo">
          Color Variable</span></label></td>
      </tr>
      <tr>
        <td width = "125" align="right" valign="top"><span class="style3">Mailing Notes:</span></td>
        <td colspan="4"><span class="style3">
          <textarea cols=23 name="Mailing_Notes" rows=4 wrap=virtual></textarea>
        </span></td>
      </tr>
      <tr>
        <td align="right" class="style3">Inserting:</td>
        <td colspan="4"><label class="style3">
          <input type="checkbox" name="Machine Insert (Matched)" id="Machine Insert (Matched)">
          Machine Insert (Non-Match)
          <input type="checkbox" name="Machine Insert (Matched)2" id="Machine Insert (Matched)2">
          Machine Insert (Match) <br>
          <input type="checkbox" name="Hand Insert (Generic)" id="Hand Insert (Generic)">
          Hand Insert (Generic)
          <input type="checkbox" name="Hand Insert (Matched)" id="Hand Insert (Matched)">
          Hand Insert (Matched)</label></td>
      </tr>
      <tr>
        <td width = "125" align="right"><span class="style3">Tabbing:</span></td>
        <td colspan="4"><span class="style3">
          <select name="Tab" size="1">
            <option value="">:: Select One ::</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">2</option>
            <option value="4">2</option>
          </select>
        </span></td>
      </tr>
      <tr>
        <td align="right" class="style3">Flats:</td>
        <td colspan="4"><label>
          <input type="checkbox" name="Sort &amp; Bundle" id="Sort &amp; Bundle">
          <span class="style3"> Sort & Bundle</span></label></td>
      </tr>
      <tr>
        <td align="right" class="style3">Postage:</td>
        <td colspan="4"><label class="style3">
          <input type="checkbox" name="Indicia" id="Indicia">
          Indicia
          <input type="checkbox" name="Hand Stamp" id="Hand Stamp">
          Hand Stamp
          <input type="checkbox" name="Machine Stamp" id="Machine Stamp">
          Machine Stamp
          <input type="checkbox" name="Meter Inline" id="Meter Inline">
          Meter Inline
          <input type="checkbox" name="Meter Offline" id="Meter Offline">
          Meter Offline</label></td>
      </tr>
    <tr>
    </table>
    <table width = "800" border = "0" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
    <tr>
    <td width = "106" align="right" ><span class="style3">Shipping: </span></td>
    <td width="82" align="Left"><span class="style3"> Zip:</span></td>
    <td width="592"><INPUT NAME="Zip" TYPE="text" VALUE="" SIZE=5 MAXLENGTH=10></td>
    </tr>
    <tr>
    <td><span class="style4"></span></td>
    <td align="left"><span class="style3"> City:</span></td>
    <td><INPUT NAME="City" TYPE="text" VALUE="" SIZE=20 MAXLENGTH=50></td>
    </tr>
    <tr><td><span class="style4"></span></td>
    <td align="left"><span class="style3"> State:</span></td>
    <td><span class="style3">
      <select name="state">
        <option value="null">:: Select State ::</option>
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
        <option value="CA">California</option>
        <option value="CO">Colorado</option>
        <option value="CT">Connecticut</option>
        <option value="DE">Delaware</option>
        <option value="FL">Florida</option>
        <option value="GA">Georgia</option>
        <option value="HI">Hawaii</option>
        <option value="ID">Idaho</option>
        <option value="IL">Illinois</option>
        <option value="IN">Indiana</option>
        <option value="IA">Iowa</option>
        <option value="KS">Kansas</option>
        <option value="KY">Kentucky</option>
        <option value="LA">Louisiana</option>
        <option value="ME">Maine</option>
        <option value="MD">Maryland</option>
        <option value="MA">Massachusetts</option>
        <option value="MI">Michigan</option>
        <option value="MN">Minnesota</option>
        <option value="MS">Mississippi</option>
        <option value="MO">Missouri</option>
        <option value="MT">Montana</option>
        <option value="NE">Nebraska</option>
        <option value="NV">Nevada</option>
        <option value="NH">New Hampshire</option>
        <option value="NJ">New Jersey</option>
        <option value="NM">New Mexico</option>
        <option value="NY">New York</option>
        <option value="NC">North Carolina</option>
        <option value="ND">North Dakota</option>
        <option value="OH">Ohio</option>
        <option value="OK">Oklahoma</option>
        <option value="OR">Oregon</option>
        <option value="PA">Pennsylvania</option>
        <option value="RI">Rhode Island</option>
        <option value="SC">South Carolina</option>
        <option value="SD">South Dakota</option>
        <option value="TN">Tennessee</option>
        <option value="TX">Texas</option>
        <option value="UT">Utah</option>
        <option value="VT">Vermont</option>
        <option value="VA">Virginia</option>
        <option value="WA">Washington</option>
        <option value="WV">West Virginia</option>
        <option value="WI">Wisconsin</option>
        <option value="WY">Wyoming</option>
      </select>
    </span></td>
    </tr>
    <tr>
    <td><span class="style4"></span></td>
    <td colspan="2"><span class="style3">(If not specified will be FOB our dock.)</span></td>
    </tr>
    </table>
    <table width = "800" border = "0" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
    <tr>
    <td width = "125" align="right" valign="top"><span class="style3">Special instructions:</span></td>
    <td colspan="4"><TEXTAREA cols=23 name="Special_Instructions" rows=4 wrap=virtual></TEXTAREA></td>
    </tr>
    <tr>
    <td></td>
    <td><input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Reset" value="Reset"></td>
    </tr>
    </table>
    </form>
    <TR><TD vAlign=top> </TD>
    </TR>
    </TBODY>
    </TABLE>
    </TD>
    </TR>
    </TBODY>
    </TABLE>
    </BODY><!-- InstanceEnd --></HTML>
    aspform.asp . . . the form that processes the data and dumps it into a .csv file
    <%
    'ASP Form Processor
    Dim datafile, redirectpage
    datafile=Request.Form("filesave")
    redirectpage=Request.Form("redirpage")
    Dim fso, f
    Set fso=Server.CreateObject("Scripting.FileSystemObject")
    Set f=fso.OpenTextFile(Server.MapPath ("response.csv"), 8, True)
    f.WriteBlankLines(1)
    f.WriteLine "Date : " & CStr(Date)
    For Each field in Request.Form
    If field<>"filesave" And field<>"redirpage" Then
    f.WriteLine field & " : " & Request.Form(field)
    End If
    Next
    f.WriteBlankLines(1)
    f.Close
    Set f=Nothing
    Set fso=Nothing
    Response.Redirect "thankyou.asp"
    %>
    response.csv . . . the data collected from the form which is out of order
    Date : 11/10/2009
    to :   [email protected]
    Flat_Size :   18x6
    Finished/Folded_Size:   : 9x6
    Ink_Notes :   heavy
    City :
    Submit :   Submit
    subject :   Franklin Request a Quote Form
    Quantity :   100000
    Size_Notes :
    Other2 :
    Ink_Inside_Pages_Front :
    Ink_Inside_Pages_Back :
    Duplex   Laser : on
    print_blank_fields   : 1
    Contact_Name   : MM
    Contact_Email   : [email protected]
    Proof_Required   : PDF
    Cover_Weight :
    Inside_Pages_Color :
    Inside_Pages_Weight :
    Inside_Pages_Brand :
    Inside_Pages_Finish :
    Binary :   Fold
    Company_Name   : FP
    Number_of_Pages   : 1
    textfield :
    textfield2 :
    Paper_Notes :
    Indicia :   on
    Date_estimate_needed : NOV
    10
    RadioGroup1   : 2
    RadioGroup3   : Yes
    Cover_Color   :
    Special_Instructions :
    Self Mailer   : on
    Self Mailer Finish2 :
    Cover_Brand :
    Self Mailer   Ink Front : 4
    Self Mailer   Ink Front2 : 4
    Self Mailer   Ink Front3 : 4
    Self Mailer   Ink Front4 : 4
    Self Mailer   Ink Front5 : 4
    Self Mailer Ink Front6 :
    Self Mailer   Ink Front7 : 4
    Self Mailer Ink Front8 :
    Self Mailer   Ink Front9 : 4
    Self Mailer Ink Front10 :
    Ink_Cover_Front :
    Ink_Cover_Back :
    state :   null
    Specify :
    Postcard   Color2 : white
    Postcard   Weight2 : 100
    Postcard   Type : cover
    Postcard   Finish2 : gloss
    Postcard Color :
    Postcard Weight :
    Postcard Type Weight :
    Postcard Finish :
    Mailing_Notes :
    Invitation Color :
    Invitation Weight :
    Invitation Type :
    Tab : 2
    Zip :
    Cover_Finish :
    Any response would be greatly appreciated.

    The order that fields appear in the request object is somewhat arbitrary. If you want to control the order, then you can reference each field by name rather than iterating through the collection. Or, you can try this method:
    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=64

  • Bit of a headache

    Hi all,
    I have found this bit of javascript to validate a users form
    input, but the problem is that it does it in steps - ie it will
    check the name and if that isn't present it will stop the form and
    display just the name error.
    However I want it to display all the errors in one go (so if
    the name AND the email is left blank, it will display both errors
    at the same time!). I am sure it has to do with where you place the
    return false value but after an hour of mucking about I just don't
    seem to be able to get it to work.
    Here is the script:
    function checkForm() {
    name = document.getElementById("name").value;
    email = document.getElementById("email").value;
    comment = document.getElementById("comment").value;
    if (name == "") {
    hideAllErrors();
    document.getElementById("nameError").style.display =
    "inline";
    document.getElementById("name").select();
    document.getElementById("name").focus();
    return false;
    } else if (email == "") {
    hideAllErrors();
    document.getElementById("emailError").style.display =
    "inline";
    document.getElementById("email").select();
    document.getElementById("email").focus();
    return false;
    } else if (comment == "") {
    hideAllErrors();
    document.getElementById("commentError").style.display =
    "inline";
    document.getElementById("comment").select();
    document.getElementById("comment").focus();
    return false;
    return true;
    function hideAllErrors() {
    document.getElementById("nameError").style.display = "none"
    document.getElementById("emailError").style.display = "none"
    document.getElementById("commentError").style.display =
    "none"

    I think you need to add a ';' (one of each) in the following
    script code as follows below:
    Your code as shown earlier:
    From here:
    document.getElementById("nameError").style.display = "none"
    document.getElementById("emailError").style.display = "none"
    document.getElementById("commentError").style.display =
    "none"
    To here:
    document.getElementById("nameError").style.display = "none";
    document.getElementById("emailError").style.display = "none";
    document.getElementById("commentError").style.display =
    "none";
    I will take a look at Elaine's quick advice. Let us know if
    that works with ';' at end of those three codes.
    Thanks in advance, DWD

  • A Problem with the JavaScript Code can anybody help me

    Hi every body,
    I prepared a html page using the following code, which i grab it from some web site, and used it in my web project,
    but the code that is not working and it is showing some javascript error, can anybody correct it for me please, the code is as follows
    <html>
    <head>
    <title>Contact Form</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    // CSS goes here
    </style>
    <script language="JavaScript">
    function checkForm()
       var cname, cemail, csubject, cmessage;
       with(window.document.msgform)
          cname    = sname;
          cemail   = email;
          csubject = subject;
          cmessage = message;
       if(trim(cname.value) == '')
          alert('Please enter your name');
          cname.focus();
          return false;
       else if(trim(cemail.value) == '')
          alert('Please enter your email');
          cemail.focus();
          return false;
       else if(!isEmail(trim(cemail.value)))
          alert('Email address is not valid');
          cemail.focus();
          return false;
       else if(trim(csubject.value) == '')
          alert('Please enter message subject');
          csubject.focus();
          return false;
       else if(trim(cmessage.value) == '')
          alert('Please enter your message');
          cmessage.focus();
          return false;
       else
          cname.value    = trim(cname.value);
          cemail.value   = trim(cemail.value);
          csubject.value = trim(csubject.value);
          cmessage.value = trim(cmessage.value);
          return true;
    function trim(str)
       return str.replace(/^\s+|\s+$/g,'');
    function isEmail(str)
       var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|
    ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|
    bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|
    ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|
    dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|
    gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|
    hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|
    kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|
    ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|
    mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|
    nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|
    re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|
    su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|
    ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|
    zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
    </script>
    </head>
    <body>
    <form method="post" name="msgform">
    <table width="500" border="0" align="center" cellpadding="2" cellspacing="1" class="maincell">
    <tr>
    <td width="106">Your Name</td>
    <td width="381"><input name="sname" type="text" class="box" id="sname" size="30"></td>
    </tr>
    <tr>
    <td>Your Email</td>
    <td>
    <input name="email" type="text" class="box" id="email" size="30">
    </td></tr>
    <tr>
    <td>Subject</td>
    <td><input name="subject" type="text" class="box" id="subject" size="30"></td>
    </tr>
    <tr>
    <td>Message</td>
    <td><textarea name="message" cols="55" rows="10" wrap="OFF" class="box" id="message"></textarea></td>
    </tr>
    <tr align="center">
    <td colspan="2"><input name="send" type="submit" class="bluebox" id="send" value="Send Message" onClick="return checkForm();"></td>
    </tr>
    <tr align="center">
    <td colspan="2"> </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    function isEmail(str)
       var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|
    ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|
    bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|
    ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|
    dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|
    gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|
    hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|
    kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|
    ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|
    mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|
    nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|
    re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|
    su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|
    ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|
    zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
    Remove all enter sequences inbetween lines in the above function. It vl work.
    All d Best :-)

  • User message entered in Validation settings does not show up in custom list form created in sharepoint designer 2010

    I have a custom list form created in SPD based on EditItem form.  I then set field validation in Validation setting and entered a user message to display when the validation did not pass.
    The validation works in the custom form but the user message never show up.
    I see a similar question posted in 2012:  
    https://social.technet.microsoft.com/Forums/en-US/cd292b50-856f-4dfa-8cfe-aeb688ee7185/validating-fields-on-a-sharepoint-2010-custom-list-form?forum=sharepointgeneralprevious 
    Is this still a known bug?   What is the easiest workaround?

    Hi ,
    From the
    above link you mentioned, have you tried using the code line in your custom form?
    Please try the code suggested by sp-achiever and hamish, and see if it could help solve the issue.
    <SharePoint:ItemValidationFailedMessage ControlMode="New" runat="server" ID="checkform" />
    Have you installed hotfix KB245789 or CU contained this kb?
    Please check if KB245789 has fixed this issue as KP2011 suggested in the same post, and please try it in a test environment firstly.
    http://support.microsoft.com/kb/2405789
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you havefeedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • HELP!!!!!!!!! 3 Submit Buttons on 1 JSP page

    Hi,
    I would really appreciate any assistance to my question. I have 3 submit buttons that need to be passed to another JSP page.
    1. Is it possible to use submit 3 times like here?
    <input type="submit" name="btnSub" value="Modify">
    <input type="submit" name="btnSub" value="Remove">
    <input type="submit" name="btnSub" value="Pssword Reset">
    2. Below is my code. Can you show me how to pass the values from the 3 submit buttons?
    Thanks in Advance!
    </form>
    </td>
    <td width=212 style='width:159.0pt;background:#FFE599;padding:0in 0in 0in 0in'>
    <!-- Profile Maintenance ------------------------------------------------------------------------->
    <div align=center>
    <table border=2 cellpadding=0 style='mso-cellspacing:1.5pt;mso-padding-alt:
    0in 0in 0in 0in'>
    <form NAME="queryUserName" method="GET" ENCTYPE="application/x-www-form=urlencoded"
    action="securityProfile.jsp"> <!-- onSubmit = "return checkForm();"-->
    <tr>
    <td colspan=2 style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal align=center style='text-align:center'><b><span
    style='font-size:10.0pt;font-family:Geneva;color:#990000'> Profile Maintenance </span></b> </p>
    </td>
    </tr>
    <tr>
    <td align=center colspan=2 style='padding:0in 0in 0in 0in'>
    <select name="UserID" size="5">
    <option selected value="NO_VALUE"> --Select an Admin-- </option>
    <% while(rset.next())
    v_ID = rset.getString("ID");
    v_Name = rset.getString("Name");
    %>
    <option value="<%= v_ID %>"><%= v_Name%></option>
    <% System.out.println("List of Options counter: *** " + i + " ***"); %>
    <!-- <option value="<%= i %>" > <%= v_Name%> </option> -->
    <%
         i = i + 1;
    %>
    </select></font></td>
    </td>
    </tr>
    <tr>
    <td align="center" style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal><span style='font-size:7.5pt;font-family:Geneva;
    color:#990000'> To modify admin's access to Corp Functions, Business Units, & Dept IDs: </span><br>
    <input type="submit" name="btnSub" value="Modify Profile"> </p>
    </td>
    </tr>
    <tr>
    <td align="center" style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal><span style='font-size:7.5pt;font-family:Geneva;
    color:#990000'> To remove an admin: </span><br>
    <input type="submit" name="btnSub" value="Remove Admin"> </p>
    </td>
    </tr>
    <tr>
    <td align="center" style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal><span style='font-size:7.5pt;font-family:Geneva;
    color:#990000'> To change admin's password: </span><br>
    <input type="submit" name="btnSub" value="Password Reset"> </p>
    </td>
    </tr>
    </form>

    When implementing the code below, it only reads the first form, and then stops there. It doesn't execute the 2nd form.
    <form name='form_1' action='T2.jsp'>
    <input type=hidden name="user" value="Me">
    <input type=submit value='Button1'>
    <form name='form_2' action='T3.jsp'>
    <input type=submit value='Button2'>
    </form>
    </form>
    If I put each form separtely like below, then it returns nothing.
    <form name='form_1' action='T2.jsp'>
    <input type=hidden name="user" value="Me">
    <input type=submit value='Button1'>
    </FORM>
    <form name='form_2' action='T3.jsp'>
    <input type=submit value='Button2'>
    </FORM>
    What's my other alternative? I would appreciate any help.

  • Session tracking

    Hi there,
    I have a strange problem you may be able to shed some light on. At least I hope so. I'm working with an existing project using JSP's and Servlets and a backend MySQL database. The project entails the ability to perform ad hoc queries to the database. The source code files can be found at the bottom of the page at:
    http://www.eas.asu.edu/~cse494db/IonJDBC/JDBCExample.html
    The project contains one servlet called Contol.java and a bean called QueryBean.java. The Control servlet is first invoked using a POST call. In doing so, a Session object is created and an instance of QueryBean is created and stored in the Session object. The QueryBean contains the meta data for the database. A jsp called QueryInput.jsp loads and at the same time also activates a second browser window loading MetaTables.jsp. When MetaTables.jsp loads in the second window it calls
    QueryBean qb = (QueryBean)session.getAttribute("qBean");
    from the session object retrieving the QueryBean instance and the meta data is used to be displayed in a table. The first time this process occurs everything is fine, until I dismiss the window containing MetaTables.jsp.
    Here's what happens...QueryInput.jsp has a button on it. It is used to re-display the window that MetaTables.jsp loads into if the user dismisses that window when it first loads. Here's where the interesting part comes in. If I click on the button in the main browser window containing QueryInput.jsp the second browser window appears alright, but for whatever reason all the data that was in the QueryBean instance is gone. MetaTables.jsp loads and attempts to obtain the QueryBean instance again from the Session object, but there is no data to display. It's gone!
    What's going on? Does anybody know?
    Alan
    ***************QueryInput.jsp*************************
    <%@ page import = "java.io.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "com.components.QueryBean" %>
    <jsp:useBean id="qBean" class="com.components.QueryBean" scope="session"/>
    <%
    String ManagerOnBoard = (String)session.getAttribute("ManagerOnBoard");
    if(ManagerOnBoard == null)
    %>
    <HTML>
    <HEAD>
    <TITLE>MainMenu</TITLE>
    <link href="site.css" rel="stylesheet" type="text/css">
    </HEAD>
    <body>
    <h1>ACCESS DENIED</h1>
    </body>
    </html>
    <%
    else
    %>
    <HTML>
    <head>
    <link href="site.css" rel="stylesheet" type="text/css">
    <script language=javascript>
        function MetaData()
    window.open('MetaData.jsp','','toolbar=no,resizable=yes,menubar=no,location=no,height=400,width=400');
    </script>
    </head>
    <BODY onLoad="MetaData()">
    <b><center><h2><jsp:getProperty name="qBean" property="dbName"/> Database </h2></center></b>
    <hr>
    <form action=MainMenu.jsp target =_parent>
    <p><input type="SUBMIT" VALUE="Return to Main Menu"></p>
    </form>
    <b>SQL Select/Insert/Update/Delete:</b><br>
    <table><tr><td>
    <form name="MyForm" action="/scholastic/Control" method="GET" TARGET="Output" onsubmit="return checkForm(this)">
      <p><textarea name="query" rows=9 cols=40>
      </textarea></p>
      </td><td><p><input type="SUBMIT" VALUE="Submit">��
      </p><p><input type="RESET" name="clear" VALUE="Clear">��
      </p><p><input type="button" value="Open MetaData" onClick="MetaData()">
    </form>
    </td>
    </tr>
    </table>
    </BODY>
    </HTML>
    <%
    %> **********************MetaTables.jsp*****************
    <%@ page import = "java.io.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.util.*" %>
    <%@ page import = "com.components.QueryBean" %>
    <!--jsp:useBean id="qBean" class="com.components.QueryBean" scope="session"/-->
    <%
       QueryBean qb = (QueryBean)session.getAttribute("qBean");
       Vector tables = (Vector)qb.getTables();
       String ManagerOnBoard = (String)session.getAttribute("ManagerOnBoard");
    if(ManagerOnBoard == null)
    %>
    <HTML>
    <HEAD>
    <TITLE>MainMenu</TITLE>
    <link href="site.css" rel="stylesheet" type="text/css">
    </HEAD>
    <body>
    <h1>ACCESS DENIED</h1>
    </body>
    </html>
    <%
    else
    %>
    <HTML>
    <head>
    <link href="site.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <!--jsp:getProperty name="qBean" property="dbName"/-->
    <center><h2> <%=qb.getDbName()%> Database MetaData</h2></center>
    <%
       for(int i =0; i< tables.size(); i++)
    %>    <table><tr>
          <%
          StringTokenizer token = new StringTokenizer((String)tables.get(i));
          String tableName = ((String)token.nextToken()).toUpperCase();
          %>
          <th><a href="/scholastic/Control?tableName=<%=tableName%>" target=Output><%=tableName%></a></th><th> :</th>
          <%
          while(token.hasMoreTokens())
         %>  
               <th><%=token.nextToken()%></th>
         <%
         %>
          </tr></table>
    </body>
    </html>
    <%
    %> ******************Control.java************************
    package com.components;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;
    public class Control extends HttpServlet
        Connection connection = null;   // the connection to the database
        Statement statement = null;   // a statement object for the queries
        String dbName;           // the database name
        public QueryBean qBean = null;
        private ServletContext context;   // objects used to transfer control to the jsp pages
        /*Initializing the servlet*/
        public void init(ServletConfig config) throws ServletException
            super.init(config);
    context = config.getServletContext(); 
         The doPost method handles POST requests
         This method is accessed first in from the time the user will
         enter a datasource name in the main page.
         The function will first establish a connection to the database
         with the requested data source name. If the data
         source does not exist then the control is tranferred to an error page
         with a corresponding message. If the database exists
         then we save time by getting all the meta-data from the database
         ( table names, and columns) and storing them in the
         bean. The bean is stored in the session object and control is
         transferred to the query page which loads the two frames. One
         for entering the query and one for results. This function is
         accessed only whenever we are in the main page.
        public void doPost(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException
          ResultSet rsTables = null; //ResultSet objects for the database tables and columns
          ResultSet rsColumns = null;
          //databse metadata object to access the meta-data from the database   
          DatabaseMetaData dbmd = null;
          qBean = new QueryBean(); // the bean object to store the information
          //the database source name entered from the user
          dbName = "scholastic_db";
          //store the database name in the query bean so pages can diplayed it later.
          qBean.setDbName(dbName);  
          String tableName;
          // The code below gets the database table names and
          // columns and stores them in the bean
          try
             Context ctx = new InitialContext();
             if(ctx == null )
                throw new Exception("No Context available...");
             DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Scholastic");
             if (ds != null)
               connection = ds.getConnection();
               if(connection != null)
                 HttpSession session = req.getSession(true);
                 dbmd = connection.getMetaData();
                 rsTables = dbmd.getTables(null, null, null, null);
          while (rsTables.next())
            StringBuffer buff = new StringBuffer();
                   tableName = rsTables.getString("TABLE_NAME");
            if (rsTables.getString("TABLE_TYPE").equals("TABLE"))
                     buff.append(tableName + " ");
              rsColumns = dbmd.getColumns(null,null,tableName,null);
                     while (rsColumns.next())
                        buff.append(rsColumns.getString("COLUMN_NAME") + " ");
              qBean.setTables(buff.toString());
                // put the bean in the session
                session.setAttribute("qBean", qBean); 
                // transfer control to the query page
                res.sendRedirect("/scholastic/manager/Query.jsp");
                rsTables.close();
                rsTables = null;
                rsColumns.close();
                rsColumns = null;
                connection.close();
                connection = null;
          catch (Exception e)
            // If there is an error with the database source
            // transfer control to an error page
            try
              connection.close();
              connection = null;
            catch(SQLException sqle){;}
    res.sendRedirect("/scholastic/manager/errorDbSource.jsp");
          finally
            // Always make sure result sets and statements are closed,
            // and the connection is returned to the pool
            if (rsTables != null)
              try { rsTables.close(); } catch (SQLException e) { ; }
              rsTables = null;
            if (rsColumns != null)
              try { rsColumns.close(); } catch (SQLException e) { ; }
              rsColumns = null;
            if (connection != null)
              try { connection.close(); } catch (SQLException e) { ; }
              connection = null;
       /* The doGet method handles GET requests. This function is accessed
          every time we enter a query using the query form of
          the queryInput pages and also every time we want to display
          the contents of a table in the metadata window since we
          actually perform a SELECT * FROM tableName statement. We
          display the results in the same page if there are select statements
          to save code. There is only one difference. In the query frames,
          we actually display the query itself along with the results,
          but in the metadata we dont. Since we access only one method, the doGet
          for both operations we determine at the beginning of
          the function; if we came from queryInput or from metaTables page.
          If we came from the queryInput page we perform the necessary
          calculation and we put the results along with the query itself
          in a bean. If it is a select statement we transfer control to the
          QueryOutputProccess page where we display the query itself and a
          table with the results. If its an update, insert, or delete,
          we perform the operation but we transfer control in a different
          page; the QueryOutputProccesUpdate where we output the result of
          our statement.
          If we come from the metadata, then we perform the query SELECT * FROM
          tableName and we store the results in the bean as we did
          before. Since we don't display the query itself from the metadata but
          we are using the same page we save to the query bean an
          empty string.
          In all the cases, we check if the user has made an error by entering
          no data or bad data in the query window. If this is the case,
          we transfer control to a page where we display the appropriate message.
          If the user has caused an SQL exception like selecting data from a table
          that does not exist, we get the corresponding message
          of the exception and we transfer control to another page.
       public void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException
          //System.out.println("Entering doGet");
          String query; // the query
          ResultSet resultSet = null; // a resultset object that holds the results of the query
          QueryBean qBean = new QueryBean();   // a QueryBean object
          try
            Context ctx = new InitialContext();
            if(ctx == null )
               throw new Exception("No Context available...");
            DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Scholastic");
            if (ds != null)
               connection = ds.getConnection();
               if(connection != null)
                 HttpSession  session = req.getSession(true); //get the session object
                 statement = connection.createStatement(); // create a statement object
                 // check to see if the user is coming from the metadata 
                 String tableName = (String)req.getParameter("tableName");
                  NOTE: THE LINUX OPERATING SYSTEM IS PARTICULAR ABOUT CASE
                  SENSITIVITY.  THEREFORE, WE'LL TRY TO KEEP THE QUERIES IN UPPER CASE
                  SINCE THE TABLE NAMES AND FIELD NAMES WERE CREATED USING UPPER CASE.
          if(tableName != null)// by checking for a parameter tableName. If its not there
          {                    // the user is coming from the query frame.
            query = "SELECT * FROM " + tableName.toUpperCase();
            qBean.setQuery(" ");
          else
            query =(String)req.getParameter("query");
            qBean.setQuery(query.toUpperCase());
          //System.out.println(query);
                 //boolean value to know where to transfer control
                 //(QueryOutputProccess or QueryOutputProccessUpdate)
          boolean isQuery = false;
                // check if the user hase entered a valid query
                //(SELECT, INSERT, UPDATE, DELETE)
         if (checkQuery(query))
                  //if is a select then get the resuts and store them in the bean
           if ("SELECT".equalsIgnoreCase(query.substring(0,6)))
                    //System.out.println("Its a SELECT query");
                    resultSet = statement.executeQuery(query);
             ResultSetMetaData rsmd = resultSet.getMetaData();
             int numCols = rsmd.getColumnCount();
             qBean.setNumColumns(numCols);
             isQuery = true;
                    for ( int i = 1; i <= numCols; i++)
               qBean.setColumnLabel(rsmd.getColumnLabel(i));
               qBean.setColumnTypeName(rsmd.getColumnTypeName(i));
                    while(resultSet.next())
                      for (int i = 1; i <= numCols; i++)
                        qBean.setResults(resultSet.getString(i));
                  else // if its not a SELECT that means is an INSERT, UPDATE OR DELETE. Perform the operation.
                    System.out.println("Its not a SELECT query");
             statement.executeUpdate(query);
                  session.setAttribute("qBean", qBean); // put the bean back in the session
                  // transfer control to the correct jsp page.
                  //(is different if its a SELECT statement)
           if(isQuery)
                    res.sendRedirect("/scholastic/manager/QueryOutputProcess.jsp");
                  else
                    res.sendRedirect("/scholastic/manager/QueryOutputProcessUpdate.jsp");
         // If the user entered a null query or a bad query
                //(other than SELECT, INSERT, UPDATE, DELETE)
                // then transfer control to an error page indicating the message.
         else
                  //System.out.println("Null or Bad query");
           if(query.length() == 0)  
                    res.sendRedirect("/scholastic/manager/errorQuery.jsp?message=No SQL expression entered");
                  else
             res.sendRedirect("/scholastic/manager/errorQuery.jsp?message=ERROR...Invalid SQL expression entered");
                resultSet.close();
                resultSet = null;
                statement.close();
                statement = null;
                connection.close();
                connection = null;
          catch (SQLException e)
            //if there is an SQL exception get the exception's message
            //and state and transfer control to an error page
    res.sendRedirect("/scholastic/manager/errorException.jsp?state=" + e.getSQLState() + "&message=" + e.getMessage());
          catch( Exception e)
            System.out.println(e);
          finally
            if (resultSet != null)
              try { resultSet.close(); } catch (SQLException e) { ; }
              resultSet = null;
            if (statement != null)
              try { statement.close(); } catch (SQLException e) { ; }
              statement = null;
            if (connection != null)
              try { connection.close(); } catch (SQLException e) { ; }
              connection = null;
       // method for checking if the user hase enter a valid
       // query (SELECT, INSERT, UPDATE, DELETE)
       public boolean checkQuery(String query)
         boolean temp = false;
         if(query.length() > 0 && query.length() > 5)
           if(("SELECT".equalsIgnoreCase(query.substring(0,6))) ||
              ("INSERT".equalsIgnoreCase(query.substring(0,6))) ||
       ("UPDATE".equalsIgnoreCase(query.substring(0,6))) ||
       ("DELETE".equalsIgnoreCase(query.substring(0,6))))
                   temp = true;
        return temp;
    }

    The button calls the control servlet with doGet.
    What is one of the first things you do for doGet?
    QueryBean qBean = new QueryBean(); // a QueryBean object

  • HELP!!!!! JSP and Java Script

    Hi,
    I have a JSP file that I need to create 3 drop lists (choice list). If one of these 3 choice lists is selected, then the other 2 need to deselected and disabled. I need help with the code.
    Do I use JavaScript or Java? Below is the html code. I would really appreciate any help on this.
    Thanks,
    BK
    <!--
    Refer to the directory gary/reportingstd/getReqs.jsp to see how to get the value from the
    choice list and other fields.
    -->
    <html>
    <head><title>New Window Example</title>
    <STYLE TYPE="text/css" >
    td { font-size: 11px }
    th { font-size: 11px }
    body { background-color: #666666 }
    </STYLE>
    <SCRIPT>
    /* When press CANCEL button, the dialog box disappears. */
         function Closer()
              window.close();
         function checkForm()
         var f = document.queryForm;
    * Checks if an account number is entered. If not, an error message dialog pops up
    * to the user.
    * Checks if a business unit was chosen. If not, an error message dialog pops up
    * to the user.
         buChoice = f.buList.selectedIndex;
              if (f.buList.options[buChoice].value == "")
                   alert("Please choose a business unit.");
                   f.buList.focus();
                   f.toDate.select();
                   return false;
         * This <code>statusMsg()</code>is to give the user feedback while data is being entered by
         * creating a status message. This script lets you modify what is displayed in this bar,
         * giving you the ability to send messages to the user while he interacts with filling out
         * the fields.Status Messages are the phrases you see in the status bar at the bottom of a
         * window or dialog.
         * For instance: For the account number text field, as long as the cursor is in this text
         * field of Account #, there's a message at the bottom of the dialog box informing, " Enter
         * only numeric characters."
         * @param msgType
         * @ mesage the data structure to store the messages sent to the users
         function statusMsg(msgType)
    var message = "";
    if (msgType == "integer")
    message = "Enter numeric characters.";
    if (msgType == "integerDate")
    message = "between 1990 and 2010";
    if (msgType == "ListBU")
    message = "Choose which BU?";
    if (msgType == "ListMonth")
    message = "Choose a month."
    window.defaultStatus = message;
    window.status = message;
    </script>
    </head>
    <body onFocus="statusMsg('')">
    <FORM NAME= "queryForm" onSubmit = "return checkForm()" ACTION="Welcome.html">
    <TABLE Border="0" cellspacing="2" cellpadding="4">
    <TR>     
    <TD ALIGN=left>Company Code:</TD>
    <TD WIDTH="20%"><SELECT Name=choiceMonths1 size=1 onFocus="statusMsg('ListMonth')">
    <option value="" selected>
    <OPTION Value="01">01
    <OPTION Value="02"> 02
    <OPTION Value="03"> 03
    <OPTION Value="04"> 04
    <OPTION Value="05"> 05
    <OPTION Value="06"> 06
    </SELECT></TD>
         <TR>
         <TD ALIGN=left>RegionID:</TD>
         <TD><select name=buList onFocus="statusMsg('ListBU')"> // onChange = "selectionMade()"
         <option value="" selected>
         <option value=Norht ALIGN="left">North
         <option value=East ALIGN="left">East
              <option value=South ALIGN="left">South
         <option value ALIGN="left">North</select></TD></TR>
    <TR>
         <TD ALIGN=left>Business Unit ID:</TD>
         <TD><select name=buList onFocus="statusMsg('ListBU')"> // onChange = "selectionMade()"
         <option value="" selected>
         <option value=TBR ALIGN="left">TBR
         <option value=BAL ALIGN="left">BAL
         <option value ALIGN="left">ABH</select></TD></TR>
    </TR></TABLE>
    <TABLE>
    <tr>
    <TD><INPUT TYPE=submit Value=Submit></TD>
    <TD><INPUT TYPE=button NAME=btnClose VALUE=Cancel SIZE=20 ALIGN= center onClick="Closer()"></TD>
         <TD><input type=reset VALUE= Clear Query SIZE=20 ALIGN= right></TD></TR></TABLE>
    </FORM>
    </BODY>
    </html>

    What i've done in the past in this same situation is to use radio buttons alongside my dropdown lists. Whenever a radio button is selected, the corresponding dropdown list is enabled, and the other lists are all disabled. Not too hard to implement in Javascript either. Use an onClick() and set the other fields to disabled, using document.form.field.disabled = true. (and obviously, set the one you want to disabled = false). But obviously, you're still going to want to know which one to retrieve later, right? Use a hidden tag and in the same Javascript onClick, you can dynamically set the variable to whatever you want. Here's a pretty compact example using 2 fields
    function enable(field)
         if(field == "firstName")
              document.myForm.firstName.disabled = false;
              document.myForm.lastName.disabled = true;
              document.myForm.searchBy.value = "firstName"
         else
              document.myForm.firstName.disabled = true;
              document.myForm.lastName.disabled = false;
              document.myForm.searchBy.value = "lastName"
    }Or something like that. Yeah, I know it's not the greatest javascript in the world, but i was just simplifying things to give an example. Hope this helps somewhat :)
    Simon

  • How to invoke the softKeyboard for a TLF textfield in AS3?

    Hi,
    I need to use a TLF textfield in a Flash mobile app.
    How to invoke the softKeyboard on mobile devices for such a TLF textfield? I tried it the way below, but it's not showing up:
    import flash.ui.Keyboard;
    import flash.events.KeyboardEvent;
    import flash.events.SoftKeyboardEvent;
    chat.needsSoftKeyboard = true
    chat.requestSoftKeyboard()
    (I can't use a "classic textfield" for a couple of reasons)
    Any tips welcome

    If you had something like this :
    <FORM name="checkform">
    <input type="text" name="myText" size="5">
    <select size="1" name="select" onChange="check()">
    <option value="1">Number1
    <option value="2" selected>Number2
    </select>
    </FORM>Your javascript funtion would look like this :
    <script language="JavaScript">
    function check() {
         if (this.checkform.select.options[this.checkform.select.selectedIndex].value == "1") {
              this.checkform.myText.size = "20"
         } else {
              this.checkform.myText.size = "5"
    </script>Note the names of the form (checkform) and the input field (myText).

  • Online Restuarant Booking system

    Hi!
    I have just designed a website for a restuarant and now they won't to put an online booking system on the site.
    The company who provide the system say they can give a line of code which I can embed into the website.
    How do I do this with a Flash website because it's not HTML. What would the Action Script be?
    If anyone can help me I would apprecaite it.
    Cheers

    Wouldn't let me attach a file so please excuse this extra long message.
    <!doctype html public "-//w3c//dtd html 4.01 transitional//en"
      "http://www.w3.org/TR/html4/loose.dtd">
    <html dir="ltr">
    <head>
      <title>Iain Sample Restaurant - Make a Reservation</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
      <meta http-equiv="Pragma" content="no-cache">
      <meta name="description" content="Iain Sample Restaurant - Reserve Table
    Online">
      <link rel="stylesheet" href="styles/tigerlily.css" type="text/css">
    </head>
    <body bgcolor="#FFFFFF" onload="window.focus(); if (typeof(updateButton) !=
    'undefined') { updateButton(); }">
    <script language="javascript" type="text/javascript"
    src="../js/lng/calendar_modern_en.js"></script>    <script
    language="javascript" type="text/javascript" src="../js/common.js"></script>
        <script language="javascript" type="text/javascript"
    src="../js/checkForm.js"></script>
        <script language="javascript" type="text/javascript"
    src="../js/time.js"></script>
       <script language="javascript" type="text/javascript"
    src="../js/selects.js"></script>
        <script language="javascript" type="text/javascript"
    src="../js/maskedit.js"></script>
    <table border="0" cellpadding="0" cellspacing="0">
      <tr style="height: 29px">
        <td class="title" style="padding-left: 2px;">
          <div id="pageTitle">IAIN SAMPLE RESTAURANT - automatic, instant
    confirmed reservations - Tuesday, 15th September 2009</div>
        </td>
      </tr>
    </table>
    <table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top" width="374" id="mainColumn">
    <table cellspacing="0" cellpadding="0" width="374">
      <tr>
        <td>
          <table cellspacing="0" cellpadding="6" class="table">
            <tr>
              <th>Information</th>
            </tr>
            <tr>
              <td>
                hohoih
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td style="height: 20px"></td>
      </tr>
      <tr>
        <td>
          <table cellspacing="0" cellpadding="6" class="table">
            <tr>
              <th> </th>
            </tr>
            <tr>
              <td>
                TO MAKE A RESERVATION please complete the details below and
    click SHOW AVAILABILITY - please enter time requested.
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
       <td style="height: 20px"></td>
      </tr>
      <form name="main" method="post" action="find.asp">
      <input type="hidden" name="command">
      <input type="hidden" name="from_date" value="20080105">
      <input type="hidden" name="until_date" value="20190521">
      <input type="hidden" name="id_prov" value="3574">
      <tr>
        <td>
          <table cellspacing="0" cellpadding="0" class="table">
            <tr>
              <th colspan="2">What Would You Like to Book?</th>
            </tr>
            <tr style="height: 5px">
              <td width="166"></td>
            </tr>
            <tr>
              <td valign="middle"><p>   Area</td>
              <td>
                <select name="area" size="1" class="fields" style="width: 200px;
    height: 18px">
                  <option value="1130">Restaurant</option>
                </select>
              </td>
            </tr>
            <tr style="height: 6px"><td></td></tr>
          </table>
        </td>
      </tr>
      <tr>
        <td style="height: 20px"> </td>
      </tr>
      <tr>
        <td>
          <table cellspacing="0" cellpadding="0" class="table">
            <tr>
              <td colspan="2">
                <table cellspacing="0" cellpadding="0" class="tabletitle"
    style="padding: 0">
                  <tr>
                    <th>
                      <table cellspacing="0" cellpadding="0" border="0">
                        <tr>
                          <td style="width: 301px; padding-right: 5px;">When
    Would You Like to Book?</td>
                          <td style="padding-right: 5px; text-align:
    right"><table width="30" border="0" cellspacing="0" cellpadding="0">
    <tr><td class="Formtable" width="20"><a href="javascript:doNothing()"
    onclick="setDateField(document.main._day_select_date,
    document.main._month_select_date, document.main._year_select_date,
    document.main.select_date);self.newWin =
    window.open('../js/calendar.html','cal','dependent=yes,width=180,height=180,titlebar=yes,t op=243,left=232')"><img
    src="res/images/modern/calendar3.gif" width="13" height="11" border="0"
    alt="Calendar" /></a></td></tr></table>
    <script type="text/javascript">
      if (window.attachEvent)
    window.attachEvent('onload', updateHiddenDate);
      else
    window.addEventListener('load', updateHiddenDate, false);
    function updateHiddenDate() { syncDateField(document.main._day_select_date,
    document.main._month_select_date, document.main._year_select_date,
    document.main.select_date); };
    </script></td>
                          <td style="padding-right: 5px; text-align:
    right">CALENDAR</td>
                        </tr>
                      </table>
                    </th>
                  </tr>
                </table>
              </td>
            </tr>
            <tr style="height: 5px">
              <td colspan="2"> </td>
            </tr>
            <tr>
              <td width="166" valign="middle">   Date </td>
              <td><input type="hidden" name="select_date" value="20090915" />
    <table width="167" border="0" cellspacing="0" cellpadding="0">
    <tr><td class="Formtable" width="40"><select name="_year_select_date"
    class="fields" onchange="updateDate(document.main._day_select_date,
    document.main._month_select_date, document.main._year_select_date,
    document.main.select_date)"><script
    type="text/javascript">document.write(buildYearSelector(document.main.select_date,
    document.main));</script></select></td><td class="Formtable"
    width="40"><select name="_month_select_date" class="fields"
    onchange="updateDate(document.main._day_select_date,
    document.main._month_select_date, document.main._year_select_date,
    document.main.select_date)"><script
    type="text/javascript">document.write(buildMonthSelector(document.main.select_date,
    document.main));</script></select></td><td class="Formtable"
    width="30"><select name="_day_select_date" class="fields"
    onchange="updateDate(document.main._day_select_date,
    document.main._month_select_date, document.main._year_select_date,
    document.main.select_date)"><script
    type="text/javascript">document.write(buildDaySelector(document.main.select_date,
    document.main));</script></select></td></tr></table>
    <script type="text/javascript">
      if (window.attachEvent)
    window.attachEvent('onload', updateHiddenDate);
      else
    window.addEventListener('load', updateHiddenDate, false);
    function updateHiddenDate() { syncDateField(document.main._day_select_date,
    document.main._month_select_date, document.main._year_select_date,
    document.main.select_date); };
      setUpdateCall('refreshPage()')</script></td>
            </tr>
            <tr style="height: 5px">
              <td colspan="2"> </td>
            </tr>
            <tr>
              <td valign="middle">   Time </td>
              <td><select name="preferred_time" class="fields"><option
    value="12:00">12:00 PM</option><option value="12:30">12:30
    PM</option><option value="13:00">1:00 PM</option><option value="13:30">1:30
    PM</option><option value="14:00">2:00 PM</option><option value="14:30"
    selected>2:30 PM</option><option value="18:00">6:00 PM</option><option
    value="18:30">6:30 PM</option><option value="19:00">7:00 PM</option><option
    value="19:30">7:30 PM</option><option value="20:00">8:00 PM</option><option
    value="20:30">8:30 PM</option><option value="21:00">9:00 PM</option><option
    value="21:30">9:30 PM</option></select></td>
            </tr>
            <tr style="height: 6px">
              <td colspan="2"> </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td style="height: 20px"></td>
      </tr>
      <tr>
        <td>
          <table cellspacing="0" cellpadding="0" class="table">
            <tr>
              <th colspan="2">How many People?</th>
            </tr>
            <tr style="height: 10px">
              <td colspan="2"></td>
            </tr>
            <tr>
              <td width="166" valign="middle">   Number of
    People </td>
              <td>
                <select name="covers" size="1" class="fields">
                  <option value="1">1</option>
    <option value="2" selected>2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
                </select>
              </td>
            </tr>
            <tr style="height: 10px">
              <td colspan="2"></td>
            </tr>
          </table>
        </td>
      </tr>
    <!-- type - if -->
      <tr>
        <td>
          <table cellspacing="0" cellpadding="0" class="table">
            <tr>
              <td width="167" valign="middle">   <a
    href="ratecode.asp">Special Offer Code</a><br />   (If
    applicable)</td>
              <td><input type="text" class="fields" name="discount_code"
    size="25" value="" style="width: 156px;"></td>
            </tr>
            <tr>
              <td height="10"> </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td> </td>
      </tr>
      <tr>
        <td valign="middle">
           <a class="img-button" title="Show Availability"
    href="javascript:execute(1)">Show Availability</a><br />
        </td>
     

  • Server side form validation

    Hi exprets.
    How can i validate a form with jsp without the involvement of any client side script so that when a field is not filled properly it should display the form again with the data filled previously and a message against the incorrect field.
    I have a generic asp code that can be used with any form. There are some complexities in it for me in converting it to jsp because I am very net to it.
    Here is the asp code:
    validateForm.asp
    <%
    const errorSymbol = "<font color=red><b>*</b></font>"
    dim dicError
    set dicError = server.createObject("scripting.dictionary")
    sub checkForm
    dim fieldName, fieldValue, pFieldValue
    for each field in request.form
    if left(field, 1) = "_" then
    ' is validation field , obtain field name
    fieldName = right( field, len( field ) - 1)
    ' obtain field value
    fieldValue = request.form(field)
    select case lCase(fieldValue)
    case "required"
    if trim(request.form(fieldName)) = "" then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " is required</font>"
    end if
    case "date"
    if Not isDate(request.form(fieldName)) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & "must be a date</font>"
    end if
    case "number"
    pFieldValue=request.form(fieldName)
    if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a number</font>"
    end if
    case "intnumber"
    pFieldValue=request.form(fieldName)
    if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) or (instr(pFieldValue,".")<>0) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an integer</font>"
    end if
    case "email"
    if instr(request.form(fieldName),"@")=0 or instr(request.form(fieldName),".")=0 then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an email</font>"
    end if
    case "phone"
    pFieldValue=request.form(fieldName)
    pFieldValue=replace(pFieldValue," ","")
    pFieldValue=replace(pFieldValue,"-","")
    pFieldValue=replace(pFieldValue,"(","")
    pFieldValue=replace(pFieldValue,")","")
    pFieldValue=replace(pFieldValue,"+","")
    if Not isNumeric(pFieldValue) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a phone number</font>"
    end if
    case "login"
    Dim i, ch, login
    login = false
    pFieldValue = request.Form(fieldName)
    if len(pFieldValue) < 5 then
         login = false
    else
              for i=1 to len(pFieldValue)     
              ch = Mid(pFieldValue, i, 1)
                   if i=1 then
                        if(((ch >= "A") and (ch <= "Z")) or((ch >= "a") and (ch <= "z"))) then
                             login = true
                        else
                             login = false
                             exit for
                        end if
                   end if
                   if (i > 1) then
                        if(((ch >= "A")and(ch <= "Z"))or((ch >= "a")and(ch <= "z"))or((ch >= "0")and(ch <= "9"))or(ch = "_")) then
                             login = true
                        else
                             login = false
                             exit for
                        end if
                   end if
              next
         end if
         if login = false then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must start with an alphabet, having numbers (0-9), alphabets, the underscore and no spaces</font>"
    end if
    end select
    end if
    next
    end sub
    sub validateForm2(byVal successPage)
    if request.ServerVariables("CONTENT_LENGTH") > 0 then
    checkForm
    ' if no errors, then successPage
    if dicError.Count = 0 then
    ' build success querystring
    tString=Cstr("")
    for each field in request.form
    if left(field, 1) <> "_" then
    fieldName = field
    fieldValue = request.form(fieldName)
    tString=tString &fieldName& "=" &Server.UrlEncode(fieldValue)& "&"
    end if
    next
    Dim PageRed
    PageRed= successPage&"?"& tString
    response.Redirect(PageRed)
    end if
    end if
    end sub
    sub validateError
    dim countRow
    countRow=cInt(0)
    for each field in dicError
    if countRow=0 then
    response.write "<br>"
    end if
    response.write "<br> - " & dicError(field)
    countRow=countRow+1
    next
    if countRow>0 then
    response.write "<br>"
    end if
    end sub
    sub validate( byVal fieldName, byVal validType )
    %> <input name="_<%=fieldName%>" type="hidden" value="<%=validType%>"> <%
    if dicError.Exists(fieldName) then
    response.write errorSymbol
    end if
    end sub
    sub textbox(byVal fieldName , byVal fieldValue, byVal fieldSize, byVal fieldType, byVal fieldTitle, byVal maxLength, byVal action)
    dim lastValue
    lastValue = request.form(fieldName)
    select case fieldType
    case "textbox"
    %>
    <input name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(lastValue)
    end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" maxlength="<%=maxLength%>" <%=action%>>
    <%
    case "hidden"
    %>
    <input type="hidden" name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(lastValue)
    end if%>">
    <%
    case "password"
    %><input name="<%=fieldName%>" type="password" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write server.HTMLEncode(lastValue)
    end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" maxlength="<%=maxLength%>">
    <%
    case "textarea"
    %>
    <textarea name="<%=fieldName%>" rows="3" cols="<%=fieldSize%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" <%=action%>><%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(trim(lastValue))
    end if
    %></textarea>
    <%
    end select
    end sub %>
    End of validateform.asp
    and I use it like this:
    <!--#include file="includes/validateForm.asp" -->
    <%
         on error resume next
    %>
    <body leftmargin="0" rightmargin="0" topmargin="0">
    <%
         validateForm "addcustomer.asp"
    %>
         <form action="" method="post" name="form1" >
    <%validateError%>
    Customer Name
    <%textbox "Name", pName, 30, "textbox", "Customer Name", 50, ""%>
    <%validate "Name", "required"%>
    the last two scriptlets create a Name field which is required. If user does not fill it an error message appears against it.
    Can someone help me please.
    Sajid

    Wow... some ASP code... its strange to see ASP these days as its been ages since i have coded in ASP.
    Well to answer your question, there are couple of options to overcome this issue.
    1) Make use of Struts Framework. It automatically takes care for the error handling(ok not automatically), but error handling of the type you are looking for is built into it and one needs to modify according to his/her own application.
    2) The other option will be to submit the data to the servlet. Populate the data into the respective fields of a Bean and put the bean into session/request as per ur requirements. On the JSP page, check if there is some data in the bean. If yes, then populate the values of HTML controls from the BEAN and the one that is empty/has custom error that you might enter in servlet can be displayed as an error message to the user.
    Hopefully this works for you. Give it a shot and its correctly said, that "necessity is the mother of invention"

  • Is it hibernate or some other issue? (Slow processing)

    This method take 14sec to complete, only got 16 raw of data.
    public static List getOffersToApprove() {
            //AuthorityApproval aa = null;
            List result = null;
            Session sess = null;
            try {
                sess = Waterfind.getSessionFactory().openSession();
            } catch (net.sf.hibernate.HibernateException e) {
                logger.error("Error opening hibernate session", e);
            try {
                result = sess.find("from com.wf.AuthorityApproval aa "
                             + " where aa.checkForm = true "
                             + " and (aa.checkType is null or aa.checkType = false) "
                             + " order by aa.datePlaced");
            } catch (Exception e) {
                logger.error("Error getting offers to approve", e);
                try {
                    sess.close();
                } catch (net.sf.hibernate.HibernateException ee) {
                    logger.warn("Exception closing session", ee);
            if (sess != null) {
                try {
                    sess.close();
                } catch (net.sf.hibernate.HibernateException e) {
                    logger.warn("Exception closing session");
            return result;
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
    <hibernate-mapping>
        <class name="com.wf.AuthorityApproval" table="WATERFIND_AUTHORITY_APPROVAL">
            <id name="id" type="long">
                <generator class="native"/>
            </id> 
              <many-to-one name="waterOffer" class="com.wf.WaterOffer">
                   <column name="wateroffer"/>
              </many-to-one>
            <many-to-one name="waterfindCheck" class="com.wf.WaterfindUser">
                <column name="waterfind_check"/>
            </many-to-one>
              <property name="datePlaced" type="calendar">
                   <column name="waterfind_dateplaced"/>
              </property>
              <property name="approveType" type="boolean">
                   <column name="approve_type"/>
              </property>
              <property name="checkType" type="boolean">
                   <column name="check_type"/>
              </property>  
              <property name="checkForm" type="boolean">
                   <column name="check_form"/>
              </property>
        </class>
    </hibernate-mapping>

    Looks fine to me. Try running the query (in SQL) directly on the database and see how long it takes. You could also try using JDBC. That will at least tell you if Hibernate is slowing you down. Maybe Hibernate 3.0 would be better too. That uses this doctype.
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">When I started using Hibernate, my database performance improved because I could use lazy, greedy or other types of loading. I can't imagine it doing anything bad in this case because you don't have any sets.

  • Unexpected "Microsoft.SharePoint.SPListDataValidationException: List data validation failed."

    Steps to replicate (I suspect it can be replicated with any list, not just a survey):
    1. Create a survey
    2. Go to Survey Settings / Validation Settings, enter a formula and a user message.
    3. Respond to a survey. 
    3.1. If a formula validation succeeds, a new survey response is created.
    3.2. If a formula validation fails, I expect to see a user message created in step #2 above. Instead, I see an exception:
     Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: Microsoft.SharePoint.SPListDataValidationException: List data validation failed.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [SPListDataValidationException: List data validation failed.]
    Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename) +25667234
    Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename) +25664366
    Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e) +938
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
    Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927 
    Server Error in '/' Application.
    List data validation failed.

    Look for -- <xsl:template name="dvt_1"> in your edit/new form using designer.
    Place
    <sharepoint:itemvalidationfailedmessage
    id="checkform" ControlMode="New"
    runat="server">
    ..right underneath<Sharepoint:ItemHiddenVersion>
    ControlMode depends on what type of form you are working on. (New/Edit)
    GooLuck

  • Can't find *.vm in using velocity+struts     Hurry!

    There is an error as follow:
    Unable to find resource '/WEB-INF/blogpages/template/TemplateList.vm'
    org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/WEB-INF/blogpages/template/TemplateList.vm'
         at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:458)
         at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:341)
         at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:831)
         at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:813)
         at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:285)
         at org.apache.velocity.tools.view.servlet.VelocityViewServlet.getTemplate(VelocityViewServlet.java:540)
         at org.apache.velocity.tools.view.servlet.VelocityViewServlet.handleRequest(VelocityViewServlet.java:475)
         at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(VelocityViewServlet.java:407)
         at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(VelocityViewServlet.java:373)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
         at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
         at com.caucho.server.http.Invocation.service(Invocation.java:315)
         at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
         at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:223)
         at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:103)
         at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:80)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
         at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:980)
         at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:563)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:260)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
         at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
         at com.caucho.server.http.Invocation.service(Invocation.java:315)
         at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
         at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253)
         at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:170)
         at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
         at java.lang.Thread.run(Thread.java:534)
    struts-config.xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
    <form-beans>
    <form-bean name="checkForm" type="org.apache.struts.validator.DynaValidatorForm">
    </form-bean>
    </form-beans>
    <global-forwards type="org.apache.struts.action.ActionForward">
    <forward name="welcome" path="/welcome.jsp"/>
    <forward name="TemplateList" path="/TemplateList.do"/>
    <forward name="TemplateListAction" path="/TemplateListAction.do"/>
    </global-forwards>
    <action-mappings type="org.apache.struts.action.ActionMapping">
    <action path="/TemplateList" forward="/WEB-INF/blogpages/template/TemplateList.vm"/>
    <action path="/TemplateListAction"
    type="com.e800.blog.template.action.TemplateListAction"
    name="checkForm"
    validate="false">
    <forward name="success" path="/WEB-INF/blogpages/template/TemplateList.vm"/>
    <forward name="failure" path="/WEB-INF/blogpages/template/welcome.jsp"/>
    </action>
    </action-mappings>
    <message-resources parameter="ApplicationResources"/>
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>
    </struts-config>
    web.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <!-- Standard Action Servlet Configuration (with debugging) -->
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
              <init-param>
    <param-name>application</param-name>
    <param-value>ApplicationResources</param-value>
    </init-param>
              <!-- struts configs -->
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/struts-config.xml</param-value>
              </init-param>
              <init-param>
                   <param-name>debug</param-name>
                   <param-value>0</param-value>
              </init-param>
              <init-param>
                   <param-name>detail</param-name>
                   <param-value>0</param-value>
              </init-param>
              <load-on-startup>2</load-on-startup>
         </servlet>
    <servlet>
    <servlet-name>velocity</servlet-name>
    <servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
    <init-param>
    <param-name>org.apache.velocity.toolbox</param-name>
    <param-value>/WEB-INF/toolbox.xml</param-value>
    </init-param>
    <init-param>
    <param-name>org.apache.velocity.properties</param-name>
    <param-value>/WEB-INF/velocity.properties</param-value>
    </init-param>
    <load-on-startup>10</load-on-startup>
    </servlet>
         <!-- Standard Action Servlet Mapping -->
         <servlet-mapping>
              <servlet-name>action</servlet-name>
              <url-pattern>*.do</url-pattern>
         </servlet-mapping>
    <servlet-mapping>
    <servlet-name>velocity</servlet-name>
    <url-pattern>*.vm</url-pattern>
    </servlet-mapping>
    <!-- Welcome File List -->
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    </welcome-file-list>
         <!-- Struts Tag Library Descriptors -->
         <!--
         <taglib>
              <taglib-uri>/tags/struts-bean</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
         </taglib>
         <taglib>
              <taglib-uri>/tags/struts-html</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
         </taglib>
         <taglib>
              <taglib-uri>/tags/struts-logic</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
         </taglib>
         <taglib>
              <taglib-uri>/tags/struts-nested</taglib-uri>
              <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
         </taglib>
         -->
    </web-app>
    Hurry! Please help me to find where the error is,Thanks.

    Ken
    u are right that you will be able to find from WEB-INF directory but not from jar files.
    Make sure you add these jar files inside Classpath and JAR Dependencies under properties in which project u want to access it.
    My IDE is WSAD5.0
    if it does not work add it inside
    Project Utility JARs .....but not sure
    Riyaz

Maybe you are looking for

  • Multi-coloured text in table cell

    I have a table where individual cells can have multi-coloured text. To do this I use html when I set the text in a cell renderer. It works fine. However, when the column width is too narrow for the text then the text is wrapped. If the text is not ht

  • Disk Utility: First Aid: "Repair Disk" grayed out when i select the HD

    I'm getting the flashing question mark folder icon at startup and my Mac never does start. I'm trying to run through the repair suggestions on this forum and on the support pages but I can't do much of anything with the disk utility. (I've done the r

  • Update my macbook black to 10.6.2 and it won't reboot! just get blu screen

    I need your help please, I'm very disappointed! After Installing the new update on my mac book black my screen turn blue for long long suspicious time I have been waiting for 20 minutes then re boot and again the same issue!!! Is there any way to fix

  • LR4 Problems after upgrading CS5 to CS6

    Hello, I encountered problems with LR4.0 after I upgraded my Photoshop CS5 to CS6. LR4.0 hangs (crashes) whenever I switch to the Develop module (from any module). All other modules work just fine. I worked with LR4.0 a few months now, with no proble

  • NI myDAQ pour interfaçage labview solidworks

    salut est-il possible d'intefacer un moteur pas à pas avec NI softmotion en utilisant NI myDAQ