Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 24th, 2005, 06:01 AM
Registered User
 
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help in Depthead page

I have made this page taking codes from other pages.it has got 7 text boxes.The first five has torch buttons.I am able to get the location codes and corresponding names in the text boxes by clicking on torch buttons .problem with me is I am not able to co-relate the Javascript functions written.And I need guidance for add mode, modify mode etc.Can somebody help me to know .How should I proceed.I need to know What all javascript functions are not required.


<%@ Language=VBScript %>
<%Response.Buffer=true%>


<HTML>
<HEAD>
<TITLE><%=application("Title")%> <%=request("formHeader")%></TITLE>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link rel="stylesheet" type="text/css" href="scriptFunctions/calendar.css">
<link rel="stylesheet" type="text/css" href="style.css">
<style >
.txt_Field {
BACKGROUND-COLOR: #FCFFE8;
foreground-color:black
    }
</style>
<link rel="stylesheet" type="text/css" href="scriptFunctions/calendar.css">
<link rel="stylesheet" type="text/css" href="images/style.css">
<link rel="stylesheet" type="text/css" href="images/style1.css">
<script language="JavaScript" src="scriptFunctions/calendarcode.js"></script>
        <script language="JavaScript" src="scriptFunctions/DMS_scriptFunctions.js"></script>
        <script language="JavaScript" src="scriptFunctions/javascriptfunctions.js"></script>
        <script language="JavaScript" src="scriptFunctions/commonJS.js"></script>
        <script language="JavaScript" src="date-picker.js"></script>
        <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript></SCRIPT>
</HEAD>

<script language="JavaScript">

            //var ErrString;
            var v_DataChange=false; //Harry-TH06112K31125 for checking if data is changed in any of the text boxes

function UCaseAlpha()
            {
                if ((window.event.keyCode >=97 && window.event.keyCode <= 122) || (window.event.keyCode >= 65 && window.event.keyCode <= 90) || (window.event.keyCode >= 48 && window.event.keyCode <= 58))
                {
                    if (window.event.keyCode >= 97 && window.event.keyCode <= 122)
                    {
                        window.event.keyCode -= 32;
                    }
                }
                else
                {
                    window.event.keyCode=0;
                }
            }

            function StageCdBlur()
            {
                if(Depthead_revision.text_mode.value == 'Add')
                {
                    DispDesc(Depthead_revision.txt_loc_code.value,'txt _loc_code','','Depthead_revision','dept_head','loc _code','D')
                }
            }

            function window_onload(ErrMsg)
            {
                if (ErrMsg != "")
                {
                    ErrString = '1)' + ErrMsg + '<BR>';
                    ErrorId.style.color="#FF0000";
                    Depthead_revision.hError.value = ErrString;
                    // START Added By Sandeep Holkar on 08/03/2004 for Intergity Check
                    ErrorDiv.innerHTML =ErrString;
                    // END Added By Sandeep Holkar on 08/03/2004 for Intergity Check
                    document.Depthead_revision.txt_loc_code.style.back groundColor = "#ff0000";
                    document.Depthead_revision.txt_loc_code.style.colo r = "#ffffff";
                }
                document.Depthead_revision.txt_loc_code.focus();
            }

          function botButClicked(butObject)
            {
                var bFlag;

                if(butObject.name == "but_Save" )
                {
                    if(butObject.value=='Delete')
                    {
                        var doConfirm=confirm('Do you want to Delete?');
                        if(doConfirm)
                        {
                            bFlag=true;
                        }
                        else
                        {
                            bFlag =false;
                        }
                    }
                    else
                    {
                        bFlag = ErrorDisplay();
                    }

                    if(bFlag==true)

                    {
                        if (removeExcessWhitespace(document.Depthead_revision .hError.value)=='')
                        //This is added here because the form method is Get and on clicking Delete multiple time an error is generated
                        {
                            document.Depthead_revision.action = "Depthead_revision.asp";
                            document.Depthead_revision.submit();
                        }
                    }
                }

                if(butObject.name=='but_Close')
                {
                    if(v_DataChange==true)
                    {
                        var doConfirm=confirm('Do you want to save Changes?');
                        if(doConfirm)
                        {
                            bFlag=ErrorDisplay();
                            if(bFlag==true)
                            {
                                document.Depthead_revision.action = "Depthead_revision.asp";
                                document.Depthead_revision.submit();
                            }
                        }
                        else
                        {
                            window.location.href = document.Depthead_revision.esearchval1.value + "?text_mode=" + document.Depthead_revision.text_mode.value + "&doButMode=" + document.Depthead_revision.doButMode.value + "&formName=" + document.Depthead_revision.formName.value + "&searchPageFlag=revision"
                        }
                    }
                    else
                    {
                    window.location.href = document.Depthead_revision.esearchval1.value + "?text_mode=" + document.Depthead_revision.text_mode.value + "&doButMode=" + document.Depthead_revision.doButMode.value + "&formName=" + document.Depthead_revision.formName.value + "&searchPageFlag=revision"
                    }
                }
            }

            function validTB(tb)
                {
                    tb.style.background="red";
                    tb.focus();
                }

                function validTBundo(tb)
                {
                    tb.style.background="white";
                }

            function chkForm()
                {
                    var flgreturn;
                    ctrErr = 0;
                    flgreturn = true;
                    validTBundo(document.Depthead_revision.txt_loc_cod e);
                    if( document.Depthead_revision.txt_loc_code.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_loc_code);
                        ctrErr = ctrErr + 1; errormsg = errormsg +'<BR>' + ctrErr +'. '+' Location Code left Blank ';
                        flgreturn = false ;
                        //alert("N1")
                    }
                    else
                    {
                        validTBundo(document.Depthead_revision.txt_loc_cod e);
                        if( document.Depthead_revision.txt_loc_name.value == "" )
                        {
                            validTB(document.Depthead_revision.txt_loc_code);
                            ctrErr = ctrErr + 1;
                            errormsg = errormsg +'<BR>' + ctrErr +'. '+' Location Code Not Proper '+ '';
                            flgreturn = false ;
                            //alert("N3")
                        }
                    }

                    //alert("Nint")
                    validTBundo(document.Depthead_revision.txt_div_cod e);
                    if( document.Depthead_revision.txt_div_code.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_div_code);
                        ctrErr = ctrErr + 1;
                        errormsg = errormsg +'<BR>' + ctrErr +'. '+' Division Code left Blank '+ '';
                        flgreturn = false ;
                        //alert("N2")
                    }
                    else
                    {
                        validTBundo(document.Depthead_revision.txt_div_cod e);
                        if( document.Depthead_revision.txt_div_name.value == "" )
                        {
                            validTB(document.Depthead_revision.txt_div_code);
                            ctrErr = ctrErr + 1;
                            errormsg = errormsg +'<BR>' + ctrErr +'. '+' Division Code Not Proper '+ '';
                            flgreturn = false ;
                            //alert("N3")
                        }
                    }

                    validTBundo(document.Depthead_revision.txt_unt_cod e);
                    if( document.Depthead_revision.txt_unt_code.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_unt_code);
                        ctrErr = ctrErr + 1;
                        errormsg = errormsg +'<BR>' + ctrErr +'. '+'Unit Code left Blank '+ '';
                        flgreturn = false ;
                        //alert("N2")
                    }
                    else
                    {
                        validTBundo(document.Depthead_revision.txt_unt_cod e);
                        if( document.Depthead_revision.txt_unt_name.value == "" )
                        {
                            validTB(document.Depthead_revision.txt_unt_code);
                            ctrErr = ctrErr + 1;
                            errormsg = errormsg +'<BR>' + ctrErr +'. '+' Unit Code Not Proper '+ '';
                            flgreturn = false ;
                            //alert("N3")
                        }
                    }

                    validTBundo(document.Depthead_revision.txt_dep_cod e);
                    if( document.Depthead_revision.txt_dep_code.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_dep_code);
                        ctrErr = ctrErr + 1;
                        errormsg = errormsg +'<BR>' + ctrErr +'. '+' Department Code left Blank '+ '';
                        flgreturn = false ;
                        //alert("N2")
                    }
                    else
                    {
                        validTBundo(document.Depthead_revision.txt_dep_cod e);
                        if( document.Depthead_revision.txt_dep_name.value == "" )
                        {
                            validTB(document.Depthead_revision.txt_dep_code);
                            ctrErr = ctrErr + 1;
                            errormsg = errormsg +'<BR>' + ctrErr +'. '+' Department Code Not Proper '+ '';
                            flgreturn = false ;
                            //alert("N3")
                        }
                    }

                    validTBundo(document.Depthead_revision.txt_memp_co de);
                    if( document.Depthead_revision.txt_memp_code.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_memp_code);
                        ctrErr = ctrErr + 1;
                        errormsg = errormsg +'<BR>' + ctrErr +'. '+' Employee Code left Blank '+ '';
                        flgreturn = false ;
                        //alert("N2")
                    }
                    else
                    {
                        validTBundo(document.Depthead_revision.txt_memp_co de);
                        if( document.Depthead_revision.txt_memp_name.value == "" )
                        {
                            validTB(document.Depthead_revision.txt_memp_code);
                            ctrErr = ctrErr + 1;
                            errormsg = errormsg +'<BR>' + ctrErr +'. '+' Employee Code Not Proper '+ '';
                            flgreturn = false ;
                            //alert("N3")
                        }
                    }

                    validTBundo(document.Depthead_revision.txt_fr_dt);
                    if( document.Depthead_revision.txt_fr_dt.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_fr_dt);
                        ctrErr = ctrErr + 1;
                        errormsg = errormsg +'<BR>' + ctrErr +'. '+' From Date left Blank '+ '';
                        flgreturn = false ;
                        //alert("N4")
                    }
                    else
                    {
                        checkDate(document.Depthead_revision.txt_fr_dt);
                    }

                    validTBundo(document.Depthead_revision.txt_to_dt);
                    if( document.Depthead_revision.txt_to_dt.value == "" )
                    {
                        validTB(document.Depthead_revision.txt_to_dt);
                        ctrErr = ctrErr + 1;
                        errormsg = errormsg +'<BR>' + ctrErr +'. '+' To Date left Blank '+ '';
                        flgreturn = false ;
                        //alert("N5")
                    }
                    else
                    {
                        checkDate(document.Depthead_revision.txt_to_dt);
                        //alert(Date.parse(document.frmtplanFIN.txt_fr_dt.va lue));
                        if(Date.parse(document.Depthead_revision.txt_fr_dt .value) != Date.parse(document.Depthead_revision.txt_to_dt.va lue))
                        {
                            validTBundo(document.Depthead_revision.txt_to_dt);
                            if( !DateCheck(document.Depthead_revision.txt_fr_dt,do cument.Depthead_revision.txt_to_dt,'') )
                            {
                                validTB(document.Depthead_revision.txt_to_dt);
                                 ctrErr = ctrErr + 1; errormsg = errormsg +'<BR>' + ctrErr +'. '+' To Date Less Than From Date ';
                                flgreturn = false;
                                //alert("N6")
                            }
                        }
                    }

                                                            //
                    if(!flgreturn)
                    {
                        //document.getElementById("ErrorId").style.color = "#FF0000";
                        //ErrorId.style.color = "#ff0000";
                        //alert('Error while Processing');
                        ErrorDiv.innerHTML=errormsg;
                        //document.frmtplanFIN.hError.value = errormsg;
                        ErrorId.style.color="#FF0000";
                        //alert(ErrorDiv.innerHTML);
                        errormsg="";
                    }
                    //return false;
                    return(flgreturn);
                }

            function butCancel_onclick()
                {
                    //alert(' v '+document.frmtplanFIN.text_mode.value);
                    if(document.Depthead_revision.text_mode.value == "Modify" || document.Depthead_revision.text_mode.value == "Add")
                    {
                        //document.frmtplanFIN.txt_pr_desc.re
                        tmp_esearchval = document.Depthead_revision.esearchval.value;
                        tmp_searchPageFlag = document.Depthead_revision.searchPageFlag.value;
                        tmp_esearchval1 = document.Depthead_revision.esearchval1.value;
                        tmp_fileName = document.Depthead_revision.fileName.value;
                        tmp_formName = document.Depthead_revision.formName.value;
                        tmp_hError = document.Depthead_revision.hError.value;
                        tmp_tableName = document.Depthead_revision.tableName.value;
                        tmp_formHeader = document.Depthead_revision.formHeader.value;
                        tmp_butstatus = document.Depthead_revision.butstatus.value;
                        tmp_searchStr = document.Depthead_revision.searchStr.value;
                        //tmp_formHeader = document.frmtplanFIN.formHeader.value;
                        document.Depthead_revision.reset();

                        // putting again
                        document.Depthead_revision.esearchval.value= tmp_esearchval ;
                        document.Depthead_revision.searchPageFlag.value = tmp_searchPageFlag ;
                        document.Depthead_revision.esearchval1.value = tmp_esearchval1 ;
                        document.Depthead_revision.fileName.value = tmp_fileName ;
                        document.Depthead_revision.formName.value = tmp_formName ;
                        document.Depthead_revision.hError.value = tmp_hError ;
                        document.Depthead_revision.tableName.value = tmp_tableName ;
                        document.Depthead_revision.formHeader.value = tmp_formHeader ;
                        document.Depthead_revision.butstatus.value = tmp_butstatus ;
                        document.Depthead_revision.searchStr.value = tmp_searchStr ;
                        //document.Depthead_revision.txt_loc_code.focus();
                        //document.Depthead_revision.txt_loc_code.blur();
                    }


                }
                function but_lev_click(but)
                {
                    if Request("text_mode")="Delete"
                        //chktopicstr();
                        //alert(document.frmtplanFIN.txt_topic.value);
                        if (but.value=="Save")
                        {
                            if(!chkForm()){return false;}
                        }

// frmtplanFIN.butstatus.value =but.value;
                    Depthead_revision.butstatus.value = document.Depthead_revision.text_mode.value;
                    //change3 :New :Start
                    if(but.value=="Delete")
                    {
                     var doconfirm=confirm("Do you want to Delete?");
                     if(doconfirm)
                     {
                        Depthead_revision.action="Depthead_revision.asp";
                        Depthead_revision.submit();
                     }
                    else { return; }
                    }

                    if(but.value=="Save" || but.value=="Close")
                    {
                        if(but.value=="Close")
                        {
                            if (v_DataChange==true)
                            {
                                var doConfirm=confirm("Do you want to save?");
                                if(doConfirm)
                                {
                                    if(!chkForm()){return false;}
                                }
                                else
                                {
                                    closeForm1("Depthead_revision");
                                    return;
                                }
                            }
                            else
                            {
                                closeForm1("Depthead_revision");
                                return;
                            }
                        }

                        Depthead_revision.action="Depthead_revision.asp";
                        Depthead_revision.submit();
                    }


                }


             function blankValues ()
            {
                document.Depthead_revision.txt_loc_code.value = "";
                document.Depthead_revision.txt_div_code.value = "";
                document.Depthead_revision.txt_unt_code.value = "";
                document.Depthead_revision.txt_dep_code.value = "";
                document.Depthead_revision.txt_memp_code.value = "";
            }

            function ResetColor()
            {
                Depthead_revision.txt_loc_code.style.backgroundCol or = "";
                Depthead_revision.txt_loc_code.style.color = "";
                Depthead_revision.txt_div_code.style.backgroundCol or = "";
                Depthead_revision.txt_div_code.style.color = "";
         &
 
Old January 24th, 2005, 02:43 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I could be wrong, but I don't think there are many people on this forum willing to read 1072 lines of code they know nothing about, trying to find out what *you* need or don't need.

Why don't you try it the other way around? Remove everything and put back in what you do need. If you need help with specific issues, feel free to ask them here.

I don't want to sound rude, bit I don't think it's fair to ask other people to do your work.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: On Mercury by Red Hot Chili Peppers (Track 13 from the album: By The Way) What's This?
 
Old January 31st, 2005, 01:17 AM
Registered User
 
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<%@ Language=VBScript %>





<HTML>


<HEAD>
<TITLE><%=application("Title")%> - <%=request("formHeader")%></TITLE>
        <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
        <link rel="stylesheet" type="text/css" href="scriptFunctions/calendar.css">
        <link rel="stylesheet" type="text/css" href="style.css">
        <style >
            .txt_Field {
                    BACKGROUND-COLOR: #FCFFE8;
                    foreground-color:black
                }
        </style>
        <link rel="stylesheet" type="text/css" href="scriptFunctions/calendar.css">
        <link rel="stylesheet" type="text/css" href="images/style.css">
        <link rel="stylesheet" type="text/css" href="images/style1.css">
        <script language="JavaScript" src="scriptFunctions/calendarcode.js"></script>
        <script language="JavaScript" src="scriptFunctions/DMS_scriptFunctions.js"></script>
        <script language="JavaScript" src="scriptFunctions/javascriptfunctions.js"></script>
        <script language="JavaScript" src="scriptFunctions/commonJS.js"></script>
        <script language="JavaScript" src="date-picker.js"></script>
        <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript></SCRIPT>
        </HEAD>

<script language="JavaScript">


            var v_DataChange=false;

            function window_onload(ErrMsg)
            {
                if (ErrMsg != "")
                {
                    ErrString = '1)' + ErrMsg + '<BR>';
                    ErrorId.style.color="#FF0000";
                    Depthead_revision.hError.value = ErrString;
                    // START Added By Sandeep Holkar on 08/03/2004 for Intergity Check
                    ErrorDiv.innerHTML =ErrString;
                    // END Added By Sandeep Holkar on 08/03/2004 for Intergity Check
                    document.Depthead_revision.txt_loc.style.backgroun dColor = "#ff0000";
                    document.Depthead_revision.txt_loc.style.color = "#ffffff";
                }
                document.Depthead_revision.txt_loc.focus();
            }

            function chkKeys ()
    {
        if (window.event.keyCode==39)
        {
            window.event.keyCode =96;
        }
    }


     function ErrorDisplay()
            {
                var bFlag;
                var iSNo;
                var txtSetFocus;

                bFlag = true;
                ErrString="";
                iSNo=0;
                txtSetFocus="";
                ResetColor()

                if (removeExcessWhitespace(document.Depthead_revision .txt_loc_code.value) == "")
                {
                    iSNo++;
                    ErrString = ErrString + iSNo +') Location Code cannot be blank.'+ '<BR>';
                    document.Depthead_revision.txt_loc_code.style.back groundColor = "#ff0000";
                    document.Depthead_revision.txt_loc_code.style.colo r = "#ffffff";
                    if (txtSetFocus=="") txtSetFocus="txt_loc";
                    bFlag = false ;
                }

                if(removeExcessWhitespace(document.Depthead_revisi on.txt_div_code.value) == "")
                {
                    iSNo++;
                    ErrString = ErrString + iSNo +') Division cannot be blank.'+ '<BR>';
                    document.Depthead_revision.txt_div_code.style.back groundColor = "#ff0000";
                    document.Depthead_revision.txt_div_code.style.colo r = "#ffffff";
                    if (txtSetFocus=="") txtSetFocus="txt_div_code";
                        bFlag = false ;
                }
                if(document.Depthead_revision.txt_unt_code.value == "")
                {
                    iSNo++;
                    ErrString = ErrString + iSNo +') Unit cannot be blank.'+ '<BR>';
                    document.Depthead_revision.txt_unt_code.style.back groundColor = "#ff0000";
                    document.Depthead_revision.txt_unt_code.style.colo r = "#ffffff";
                    if (txtSetFocus=="") txtSetFocus="txt_unt_code";
                    bFlag = false ;
                }
                if(document.Depthead_revision.txt_dep_code.value == "")
                {
                    iSNo++;
                    ErrString = ErrString + iSNo +') Department cannot be blank.'+ '<BR>';
                    document.Depthead_revision.txt_dep_code.style.back groundColor = "#ff0000";
                    document.Depthead_revision.txt_dep_code.style.colo r = "#ffffff";
                    if (txtSetFocus=="") txtSetFocus="txt_dep_code";
                    bFlag = false ;
                }

                Depthead_revision.hError.value = ErrString;
                document.getElementById("ErrorDiv").innerHTML = ErrString;
                if (txtSetFocus.length>1) document.getElementById(txtSetFocus).select();
                if(!bFlag)
                {
                    ErrorId.style.color="#FF0000";
                }
                else
                {
                    ErrorId.style.color="";
                    //botButClicked(but);
                }
                return(bFlag);
            }

            function blankValues ()
            {
                document.Depthead_revision.txt_loc_code.value = "";
                document.Depthead_revision.txt_div_code.value = "";
                document.Depthead_revision.txt_unt_code.value = "";
                document.Depthead_revision.txt_dep_code.value = "";
                document.Depthead_revision.txt_emp_code.value = "";
            }

            function ResetColor()
            {
                Depthead_revision.txt_loc_code.style.backgroundCol or = "";
                Depthead_revision.txt_loc_code.style.color = "";
                Depthead_revision.txt_div_code.style.backgroundCol or = "";
                Depthead_revision.txt_div_code.style.color = "";
                Depthead_revision.txt_dep_code.style.backgroundCol or = "";
                Depthead_revision.txt_dep_code.style.color = "";
                Depthead_revision.txt_emp_code.style.backgroundCol or = "";
                Depthead_revision.txt_emp_code.style.color = "";
            }

            function doAction(button)
    {
        var bFlag;
        if(button.value=='Save')
        {
            bFlag = ErrorDisplay();
            if(bFlag==true)
            {
                document.Depthead_revision.txtbtn.value="Save";
                document.Depthead_revision.action="Depthead_revisi on.asp"
                document.Depthead_revision.submit();
            }
        }//save button

        if(button.value=='Close')
        {
            if(v_DataChange==true)
            {
                var doConfirm=confirm('Do you want to save changes?');
                if (doConfirm)
                {
                    bFlag = ErrorDisplay();
                    if(bFlag==true)
                        {
                            document.Depthead_revision.txtbtn.value="Save";
                            document.Depthead_revision.action="Depthead_revisi on.asp"
                            document.Depthead_revision.submit();
                        }
                }
                else
                {
                    //close the form
                    window.location.href = document.Depthead_revision.esearchval1.value + "?text_mode=" + document.Depthead_revision.text_mode.value + "&doButMode=" + document.Depthead_revision.doButMode.value + "&formName=" + document.Depthead_revision.formName.value + "&searchPageFlag=revision"
                }//doConfirm
            }
            else
            {
                window.location.href = document.Depthead_revision.esearchval1.value + "?text_mode=" + document.Depthead_revision.text_mode.value + "&doButMode=" + document.Depthead_revision.doButMode.value + "&formName=" + document.Depthead_revision.formName.value + "&searchPageFlag=revision"
            } //v_DataChange
        }//close button

        if(button.value=='Delete')
        {
            var doConfirm=confirm('Do you want to Delete?');
            if(doConfirm)
            {
                document.Depthead_revision.txtbtn.value="Save";
                document.Depthead_revision.action="Depthead_revisi on.asp"
                document.Depthead_revision.submit();
            }
        }//delete
    }//end of function
    </script>


    <%
    dim mixforward,filename
    dim sqlStat, RowCount
    mixforward = request("esearchval1")

    set con=Server.CreateObject("ADODB.Connection")
    con.Open connstring
    tmode = trim(Request("text_mode"))

    if tmode<>"Add" then
        loc1=trim(Request("txt_loc_code"))
        div1=trim(Request("txt_div_code"))
        unt1=trim(Request("txt_unt_code"))
        dep1=trim(Request("txt_dep_code"))
        memp1=trim(Request("txt_memp_code"))
        mempname=trim(Request("txt_memp_name"))
        frdt1 = trim(Request("txt_fr_dt"))
        todt1 = trim(Request("txt_to_dt"))

    end if

    'Response.Write tmode

    dim mixstr
    mixstr = mixforward
    filename=Mid(mixstr,(InStrRev(mixstr,"/")+1),len(mixstr))
    if tmode<>"Add" and tmode<>"Modify" then
        read="readonly"
        dis="disabled"
    end if
    if request("txtbtn")="Save" then%>
        <%if tmode="Add" then

            set rstres=server.CreateObject("adodb.recordset")
            rstres.open "select loc_code from dept_head where loc_code='" & Trim(request("txt_loc_code")) & "'",con,3,3
            if rstres.recordcount>0 then%>
                <script language="javascript">
                        alert("Duplicate Location not allowed")
                </script>
            <%else
                con.BeginTrans
                FSsql =""
                FSsql = "Insert into dept_head(dept_code,loc_code,div_code,unt_code,mem p_code,frm_dt,to_dt)"
                FSsql = FSsql & " Values('" + trim(request("txt_dep_code")) + "','" +trim(Request("txt_loc_code"))+"','" + trim(Request("txt_div_code")) + "','" + trim(request("txt_unt_code")) & "','"
                FSsql = FSsql & trim(request("txt_memp_code"))+ "','" + trim(request("txt_fr_dt"))+ "','" + trim(request("txt_to_dt")) + "')"
                con.Execute fssql
                'if trim(request("txt_address_yn"))="True" then
                'end if
                con.CommitTrans%>
                <script language="javascript">
                    window.location.href = '<%=trim(request("fileName"))%>' + '<%=trim(request("searchStr"))%>';
                    //document.Depthead_revision.action="mnumrecruitsour ce.asp"
                    //document.Depthead_revision.submit();
                </script>
            <%end if
           elseif tmode="Modify" then
             con.BeginTrans
             FSsql =""
             FSsql = "Update dept_head Set memp_code = '" & (Trim(request("txt_memp_code")))
             FSsql = FSsql & "' Where loc_code = '" & Trim(request("txt_loc_code")) & "' And div_code='" & Trim(request("txt_div_code")) & "' And unt_code='" & Trim(request("txt_unt_code")) & "' "
             FSsql = FSsql & " And dep_code = '" & Trim(request("txt_dep_code")) & "' "
            con.Execute Fssql
            con.CommitTrans%>


            <script language="javascript">
                    window.location.href = '<%=trim(request("fileName"))%>' + '<%=trim(request("searchStr"))%>';
                    //document.Depthead_revision.action="mnumrecruitsour ce.asp"
                    //document.Depthead_revision.submit();
            </script>
        <%elseif tmode="Delete" then

                set rstres=server.CreateObject("adodb.recordset")
                FSsql =""
                FSsql = "Select * from MEMPOFF where mempoff.memp_code= = '" & Trim(request("txt_memp_code")) & "'"
                rstres.Open fssql,con,3,3
                if rstres.RecordCount>0 then
                dim ErrMsg
                ErrMsg = "Source cannot be deleted,Used for an Applicant"%>

                <script language="javascript">

                </script>

                <%else
                    con.BeginTrans
                    con.Execute "Delete from dept_head where dept_head.loc_Code = '" & Trim(request("txt_loc_code")) & "'"
                    'con.Execute "Delete from MAddress where Type = 'S' And Code = '" & Trim(request("txt_source_code")) & "'"
                    con.CommitTrans
                %>
                    <script language="javascript">
                        window.location.href = '<%=trim(request("fileName"))%>' + '<%=trim(request("searchStr"))%>';
                        //document.Depthead_revision.action="mnumrecruitsour ce.asp"
                        //document.Depthead_revision.submit();
                    </script>
                <%end if
                set rstres=nothing
        end if
        'end if'added by utk
    end if
    %>

    <BODY>
<BODY bgColor=white topmargin=0 leftmargin=0 LANGUAGE=javascript onload="return window_onload('<%=ErrMsg%>')">
    <span class="cal-GreyDate"></span>
    <FORM name="Depthead_revision" id="Depthead_revision" method="get" >


<table width="100%" cellspacing=0 cellpadding=0>
    <tr>
        <td width=100% colspan=3>

        </td>
    </tr>

    <tr bordercolor="#3333CC">
          <td width="80%" align="middle" class="topgrad" height="24" ><%=request("text_Mode")%>: &nbsp;<%=request("formHeader")%></td>
          <td width="20%" align="left" class="topgrad">
            <A align=right id="ErrorId" name="ErrorId" style="CURSOR:HAND" onclick="this.blur(); return DispError();" >
            <B>Errors</B></A>

            <DIV id="ErrorDiv" name="ErrorDiv" class="div_ErrorDisplay" STYLE="Z-INDEX: 3;POSITION: absolute; LEFT: 75px; WIDTH: 637px; TOP: 20px; HEIGHT: 340px; visibility: hidden" LANGUAGE=javascript onmouseout="return ErrorDiv_onmouseout()" >
                <nobr>
                    &nbsp;&nbsp;
                </nobr>
            </DIV>

          </td>

          <td width="10%" align="left" class="topgrad">
            <a align="right" id="helpId" style="FONT-WEIGHT: normal; FONT-SIZE: 12px; CURSOR: hand; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT
             normal" onClick="WebHelp('<%=Session("formNo")%>');">
                <b>Help</b>
            </a>
        </td>
      <!--
      <td width="10%" align="left" class="topgrad">
        <A align=right id="helpId" class="errorText" style="font:12;CURSOR:HAND" onclick="this.blur(); return DispError();" ><B>Help</B></A>
      </td>
      -->
    </tr>
</table>



<table width="100%" border="0" align="center" style="LEFT:0% ;TOP:20% ;POSITION:absolute" bordercolor="#FFFFDE">
    <input type=hidden id=text_mode name=text_mode value=<%=request("text_mode")%>>

    <tr>
        <td colspan="2">
            <table width="78%" border="1" height="97" align="center" bordercolor="#6699cc" cellpadding="0" cellspacing="0">
                <tr align="left">
                    <td class="text-head" height="24" bordercolor="#FFFFFF" bgcolor="#6699CC" width="24%" >

                            <strong>Location</strong>

                    </td>
                    <%if tmode<>"Add" then
                        set rstloc=server.CreateObject("adodb.recordset")
                        rstloc.Open "select mloc_name,mloc_per from mloc where mloc_code='" & trim(loc1) & "'",con,3,3
                        if rstloc.RecordCount>0 then
                            locname=trim(rstloc("mloc_name"))
                            per=trim(rstloc("mloc_per"))
                        end if
                        set rstloc=nothing
                    else
                        per = "False" 'Added By [Harry-TU28102K31547] as Address is not validated in Add Mode and then it is validated in modify and Delete Mode
                    end if%>


                    <td style="BACKGROUND-COLOR: #ffffff" height="10" valign="middle" >
                    <input id="txt_loc_code" name="txt_loc_code" class="text" size=25 value="<%=loc1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_loc_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_loc_nam e','Depthead_revision','mloc','mloc_code','mloc_na me','V');" maxlength="35" >
                    <%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete") and (trim(tmode) <> "Modify") then %>
                    <a href="javascript:imgClickNW('txt_loc_code','Depthe ad_revision','mloc;mloc_code;mloc_name','revision' ,'txt_loc_name')" >
                    <img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
                    <%else%>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%end if%>
                    &nbsp;&nbsp;

                    <input id="txt_loc_name" name="txt_loc_name" class="text" size=25 maxlength=6 readonly value=<%=locname%>>

                    </td>
                </tr>

                <tr>
                    <td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >

                                    <strong>Division</strong>

                    </td>
                        <%if tmode<>"Add" then
                        set rstdiv=server.CreateObject("adodb.recordset")
                        rstdiv.Open "select mdiv_name from mdiv where mdiv_code='" & trim(div1) & "'",con,3,3
                        if rstdiv.RecordCount>0 then
                            divname=trim(rstdiv("mdiv_name"))
                       end if
                        set rstdiv=nothing
                    end if%>


                    <td style="BACKGROUND-COLOR: #ffffff" height="30" valign="middle" align="left" >
                     <input id="txt_div_code" name="txt_div_code" class="text" size=25 value="<%=div1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_div_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_div_nam e','Depthead_revision','mdiv','mdiv_code','mdiv_na me','V');" maxlength="35" >
                    <%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete")and (trim(tmode) <> "Modify") then%>
                    <a href="javascript:imgClickNW('txt_div_code','Depthe ad_revision','mdiv;mdiv_code;mdiv_name','revision' ,'txt_div_name')" >
                    <img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
                    <%else%>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%end if%>
                    &nbsp;&nbsp;
                    <input id="txt_div_name" name="txt_div_name" class="text" size=25 maxlength=6 readonly value=<%=divname%> >
                    </td>
                </tr>

                <tr>
                    <td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >

                        <strong>Unit</strong>

                    </td>
                        <%if tmode<>"Add" then
                        set rstunt=server.CreateObject("adodb.recordset")
                        rstunt.Open "select muni_name from munit where muni_code='" & trim(unt1) & "'",con,3,3
                            if rstunt.RecordCount>0 then
                            untname=trim(rstunt("muni_name"))
                               end if
                        set rstunt=nothing
                        end if%>

                <td style="BACKGROUND-COLOR: #ffffff" valign="center" align="left" height="30" >
                    <input id="txt_unt_code" name="txt_unt_code" class="text" size=25 value="<%=unt1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_unt_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_unt_nam e','Depthead_revision','munit','muni_code','muni_n ame','V');" maxlength="35" >
                    <%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete")and (trim(tmode) <> "Modify") then%>
                    <a href="javascript:imgClickNW('txt_unt_code','Depthe ad_revision','munit;muni_code;muni_name','revision ','txt_unt_name')" >
                    <img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
                    <%else%>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%end if%>
                    &nbsp;&nbsp;
                    <input id="txt_unt_name" name="txt_unt_name" class="text" size=25 maxlength=6 readonly value=<%=untname%> >
                    </td>
                </tr>

                <tr>

                            <td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >

                                    <strong>Department</strong>

                            </td>
                                <%if tmode<>"Add" then
                        set rstdep=server.CreateObject("adodb.recordset")
                        rstdep.Open "select mdep_name from mdep where mdep_code='" & trim(dep1) & "'",con,3,3
                        if rstdep.RecordCount>0 then
                            depname=trim(rstdep("mdep_name"))
                       end if
                        set rstdep=nothing
                    end if%>

                    <td style="BACKGROUND-COLOR: #ffffff" valign="center" align="left" height="30" >
                     <input id="txt_dep_code" name="txt_dep_code" class="text" size=25 value="<%=dep1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_dep_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_dep_nam e','Depthead_revision','mdep','mdep_code','mdep_na me','V');" maxlength="35" >
                     <%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete") and (trim(tmode) <> "Modify")then%>
                    <a href="javascript:imgClickNW('txt_dep_code','Depthe ad_revision','mdep;mdep_code;mdep_name','revision' ,'txt_dep_name')" >
                    <img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
                    <%else%>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%end if%>
                    &nbsp;&nbsp;
                    <input id="txt_dep_name" name="txt_dep_name" class="text" size=25 maxlength=6 readonly value=<%=depname%> >
                   </td>
                </tr>

                <tr>

                            <td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >

                                    <strong>Employee Code</strong>

                            </td>

                        <%if tmode<>"Add" then
                        set rstmemp=server.CreateObject("adodb.recordset")
                        rstmemp.Open "select memp_name from mempoff where memp_code='" & trim(memp1) & "'",con,3,3
                        if rstmemp.RecordCount>0 then
                             mempname=trim(rstmemp("memp_name"))
                       end if
                        set rstmemp=nothing
                    end if%>
                  &nb





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to prevent a web page/window page from copying pradeeppatnaik81 C# 2 April 9th, 2008 03:36 AM
access C#.Net page as action of calssic ASP page mansharma_s ASP.NET 1.x and 2.0 Application Design 6 January 7th, 2008 10:58 AM
How to pass the variables in Aspx page to Asp Page jayaraj ASP.NET 1.0 and 1.1 Basics 3 May 23rd, 2004 06:55 AM
How to create HTML page from a dynamic ASP page musharaf Classic ASP Professional 2 March 18th, 2004 09:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.