URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       knowledge-space
  HTML https://sravanks.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Dictionary
       *****************************************************
       #Post#: 22--------------------------------------------------
       This piece of code causes issues on javascript
       By: sravan Date: October 10, 2017, 8:35 am
       ---------------------------------------------------------
       [quote]
       <!DOCTYPE html>
       <html>
       <head>
       <title>Start Page</title>
       <meta http-equiv="Content-Type" content="text/html;
       charset=UTF-8">
       <script src="js/jquery-3.2.1.js"></script>
       <script>
       var validator = 0;
       function validate() {
       alert($("#inGameName").val());
       alert($("#serverIp").val());
       alert($("#location").val());
       alert($("#samplocation").val());
       if(isEmpty($("#inGameName").val(), "In Game Name", 0) ===
       false){
       alert("dman " + !isEmpty($("#inGameName").val(), "serverIp",
       0)); //this piece of code causes issues : when you uncomment
       below code and run it with only ingame name value, it will check
       in game name and returns true and falls to isempty serverip, but
       when it returns from the isempty function, itlands on the
       isemtpy function in alert of isempty ingamename... so weird. wtf
       alert("cjecl tjos");
       return false;
       }
       /* if(isEmpty($("#serverIp").val(), "serverIp", 0) === false){
       
       return false;
       }
       if(isEmpty($("#location").val(), "root folder of location", 0)
       === false){
       return false;
       }
       
       if(isEmpty($("#samplocation").val(), "samp location", 1) ===
       false){
       return false;
       }
       }
       function isEmpty(validateVariable, nameOfVariable, flag) {
       alert(nameOfVariable + " - -- " + flag);
       if (validateVariable === null || validateVariable ===
       undefined
       || validateVariable.length === 0) {
       validator = 1;
       alert("validator " + validator);
       alert(nameOfVariable + " should not be empty");
       return false;
       }
       if(flag === 1) {
       alert(samplocation.substring(0,
       samplocation.lastIndexOf('\\')) + " --- "+
       $("#location").val());
       if ($("#location").val() !==
       $("#samplocation").val().substring(0,
       samplocation.lastIndexOf('\\'))) {
       validator = 1;
       
       alert("samp.exe location is out of GTA Folder");
       return false;
       }
       }
       }
       </script>
       </head>
       <body>
       <h1>Hello World!</h1>
       <form method="post" action="dfcs">
       Ingame Name : <input type="text" name="inGameName"
       id="inGameName" />
       
       Server IP you want to connect : <input type="text"
       name="serverIp" id="serverIp" /> </br> GTA install location :
       <input
       type="text" name="location" id="location" /> </br> location
       of exe file :
       <input type="text" name="samplocation" id="samplocation"
       /></br> <input
       type="submit" onclick="return validate()">
       </form>
       </body>
       </html>
       [/quote]
       #Post#: 23--------------------------------------------------
       Re: This piece of code causes issues on javascript
       By: sravan Date: October 10, 2017, 8:39 am
       ---------------------------------------------------------
       tried again after posting this topic. and weird again..its
       working normal as it should. wtf
       *****************************************************