1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem with js web form buttons after moving app to new Debian Server

Discussion in 'Apache' started by jrsmith, Oct 13, 2017.

  1. #1
    First of all i'm a Sys Admin & my Systems Analyst doesn't know html, ajax, or javascript! My work inherited an old Debian 5.0 web server running Apache 2.2.9, PHP 5.0.51a-24+lenny1, & MySQL 5.0.51a. It runs a fairly simple person information database that we need to keep running so i've setup a virtuallized Debian 9.1 web server running Apache 2.4.25, php 7.0.19-1 & MariaDB 10.1.26. The webserver itself is operating fine. I've setup the sql database no problem, php is operating fine, I installed phpmyadmin & it's connecting just fine to the database with everything the same as the old server. After i moved the webserver files over I was getting some errors relating to the missing mysql api, so I got my systems analyst to update all of the php files to mysqli syntax.

    I am able to query the database & look up person info. The problem is when I try and add or modify a user using the buttons "add" or "update" instead of it adding or updating, it's bringing up a text box window with what appears to be the info that it should be sending to the database.

    I'm attaching a picture of the webform & text box that pops up after I click "add". I'm gonna paste what I think is the relevant sections of my html & javascript file, but i'm also gonna link to a zip of the full files.

    Any help will be super appreciated!!!

    *******1drv.ms/u/s!AlMbe74f1lupjZAJQUYUHWaAqApHPg

    churchmouse.png churchmouse2.png


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "*****w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="*****w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="css/autosuggest.css" />
        <link rel="stylesheet" type="text/css" href="css/web.css" />
        <!--[if !IE]>--><link rel="stylesheet" type="text/css" href="css/notIE.css" /><!--<![endif]-->
        <!--[if IE]><link rel="stylesheet" type="text/css" href="css/IE.css" /><![endif]-->
        <script type="text/javascript" src="js/bsn.AutoSuggest_c_2.1.js"></script>
        <script type="text/javascript" src="js/utils.js"></script>
        <title>Church Record System</title>
      </head>
    
    
    
    <div class="divBut">
                        <span><button onclick="setEventInfo('New', 'baptism');return false;">Add</button><button onclick="setEventInfo('', 'baptism');return false;">Update</button><button onclick="cert('bap');return false;">Certificate</button><button onclick="document.getElementById('baptism').reset();clearAllNodes('bapWitness'); return false;">Clear</button></span>
          </div>
    
    <div class="divBut">
            <span><button onclick="setEventInfo('New', 'confirm');return false;">Add</button><button onclick="setEventInfo('', 'confirm');return false;">Update</button><button onclick="notice(3);return false;">Notice</button><button onclick="cert('con');return false;">Certificate</button><button onclick="document.getElementById('confirm').reset();clearAllNodes('conWitness');return false;">Clear</button></span>
          </div>
    
    From utils.js file:
    
    function setEventInfo (writeMode, form)
    {
        evtType = formName.getIndex(form)+1;
        prefix = formPrefix[formName.getIndex(form)];
    
      //with notification:
      //var onSuccessFunc = function (ajaxClassReference) { alert(ajaxClassReference.getResponseText());getAllInfo(document.getElementById('personId').value); };
      //without notification:
      var onSuccessFunc = function (ajaxClassReference) { getAllInfo(document.getElementById('personId').value); };
        var onErrorFunc = function (status) { alert("AJAX error: "+status); };
      
      var url = window.location + "php/insertEvent.php?Mode=";
        if(writeMode == "New")
        {
            url += "New";
    
            if(form == "marriage")
            {
                //popup a window asking for a spouse
                retVal = window.showModalDialog("spouseWnd.html", "", "dialogWidth:800px;dialogHeight:300px;");
              
                if(retVal == -1)
                {
                    alert("You must choose a spouse before a wedding can be created");
                  return;
                }
                else
                {
                    document.getElementById('wedEventOwner2').value = retVal;
                }
    
            }
    
            document.getElementById(prefix+'EventOwner1').value = document.getElementById('ID').value;
            document.getElementById(prefix+'EventType').value = evtType;
        }
        else
            url += "Update";  
      
        //this field is not required in the code.
        document.getElementById('wedSpouse').disabled = true;
        document.getElementById('bapLocation').disabled = true;
        document.getElementById('fcLocation').disabled = true;
        document.getElementById('conLocation').disabled = true;
        document.getElementById('wedLocation').disabled = true;
        document.getElementById('burLocation').disabled = true;
    
        var setEventInfoAjax = new ajaxClass();
        setEventInfoAjax.serializeFormToURI(url, form, prefix);  
        setEventInfoAjax.XMLreq( "", "GET", onSuccessFunc, onErrorFunc );
      
        document.getElementById('wedSpouse').disabled = false;
        document.getElementById('bapLocation').disabled = false;
        document.getElementById('fcLocation').disabled = false;
        document.getElementById('conLocation').disabled = false;
        document.getElementById('wedLocation').disabled = false;
        document.getElementById('burLocation').disabled = false;
    }
    
    Code (markup):
     
    Last edited by a moderator: Oct 14, 2017
    jrsmith, Oct 13, 2017 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    Check the Chrome (or Firefox) DevTools console, it should give you useful information.
     
    RoseHosting, Nov 8, 2017 IP