JS Showing on Page issue.

Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality

Moderator: amosbatto

Forum rules
Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
eventoteam
Posts: 24
Joined: Wed May 17, 2017 1:39 pm
Country: Pakistan

JS Showing on Page issue.

Unread postby eventoteam » Thu Aug 03, 2017 7:06 am

Since the last time i saved the Form its Showing the JS written at the end of the case.
Attaching the snapshot of it.
Would be Glad if you let me know how to resolve this Issue.
Attachments
2017-08-03_16-03-10.png
2017-08-03_16-03-10.png (141.77 KiB) Viewed 449 times

AlanBueno
Posts: 55
Joined: Mon Mar 26, 2018 1:03 pm
Country: Bolivia

Re: JS Showing on Page issue.

Unread postby AlanBueno » Fri Apr 20, 2018 8:54 am

Could you please post the javascript code you are using in your dynaform? You may have an error in your code thats causing this

eventoteam
Posts: 24
Joined: Wed May 17, 2017 1:39 pm
Country: Pakistan

Re: JS Showing on Page issue.

Unread postby eventoteam » Mon Apr 23, 2018 9:06 am

Got this code from our team. Kindly let me know the correction needed.

Code: Select all

function validateGrid() {
   var 
totalRows Number_Rows_Grid("Level1InvestigationNotes""SLA_Action_Level1");
   var 
= (getField("dtLoggedOn").value);
   var 
"20"+a[0]+a[1] +  "-" a[2]+ a[3] + "-" a[4]+a[5];
   var 
= new Date(d);
   var 
= (getField("dtReportedOn").value);
   var 
reportdate e[0]+e[1]+ e[2]+ e[3]+e[4]+e[5]+e[6]+e[7]+e[8]+e[9];
   var 
reportdate1 = new Date(reportdate);

   if (
reportdate1 f) {
     
alert ("ReportedOn Date should be less than or equal to Logged On Date ");
     return 
false
   }
   else {
      return 
true;
   }

   for (var 
1totalRowsi++) {
   
      if (
getGridValueById("Level1InvestigationNotes"i"SLA_Action_Level1") == "") {
         
alert("Please choose SLA Action in Level 1 Investigation Grid""Error");
         return 
false;
      }
      else if (
getGridValueById("Level1InvestigationNotes"i"SLA_Action_Level1") != "Reported On") {
          
alert ("Please note that the first row should have 'Reported on' as the SLA Action of Level 1 Investigations");
          return 
false;  
      }
      else if (
getGridValueById("Level1InvestigationNotes"i"dtLevel1InvestigationDoneOn") == "") {
          
alert("Please enter the  Investigation Performed on Level 1 Investigation Grid""Error");
          return 
false;
      } 
      else if (
getGridValueById("Level1InvestigationNotes"i"dtddForLevel1Investigation") == "") {
          
alert("Please enter the DD Level 1 Investigation in  Level 1 Investigation Grid""Error");
          return 
false;
      }                  
      else if (
getGridValueById("Level1InvestigationNotes"i"CmbPersonAssigned") == "")    {
          
alert("Please choose the Performed By in  Level 1 Investigation Grid""Error");
          return 
false;
      }  
      else if (
getGridValueById("Level1InvestigationNotes"i"txtTimeTaken") == "") {
          
alert("Please enter the Time Taken in Investigation Grid""Error");
          return 
false;
      }
      else if (
getGridValueById("Level1InvestigationNotes"i"txtTimeTaken") == 0) {
         
alert(" Time Taken in level 1 Investigation Grid should not be 0""Error");
         return 
false;
      }
      else if (
getGridValueById("Level1InvestigationNotes"i"dtLevel1PersoneAssignedon") == "") {
         
alert("Please enter the Assigned on date in  level 1 Investigation Grid""Error");
         return 
false;
      }
      else if (
getGridValueById("Level1InvestigationNotes"i"dtLevel1PersoneAssignedon") == 
          (
getGridValueById("Level1InvestigationNotes"i"dtLevel1InvestigationDoneOn")))
      {
          
alert("Assigned on and Performed on Date/Time should not be Equal ""Error");
          return 
false;
      }
      else if (
getGridValueById("Level1InvestigationNotes"i"dtLevel1PersoneAssignedon") >= 
          (
getGridValueById("Level1InvestigationNotes"i"dtLevel1InvestigationDoneOn")))
      {
         
alert("Performed on date should not be less than Assigned on Date""Error");
          return 
false;
      }
      else {
          return 
true;
      }
   }
}

getField('btnSubmit').onclick validateGrid

amosbatto
Posts: 6267
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz
Contact:

Re: JS Showing on Page issue.

Unread postby amosbatto » Mon Apr 23, 2018 10:36 am

First of all, please take the time to use proper spacing so that your code is readable and use the code button in the editor. Otherwise, nobody will help you because your code is impossible to read. I just edited your post to reformat your code so it would be readable.

Your alert() calls will generate errors because that function only accepts 1 parameter, not 2. If you want a title in your error messages, you need to use G.alert() in place of alert().

You need to run this code with your web browser's debugger enabled to see any errors. You have probably misspelled a field name. In Chrome and Firefox, press F12 to activate the debugger.

If you still can't figure it out, then post the complete xml code for the Dynaform.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)


Return to “Using ProcessMaker 2”

Who is online

Users browsing this forum: No registered users and 2 guests