Checklist with validation button to update or not update

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
Please bear with me. i am very new to Javascript.

I have a checklist which has 23 questions.
Each question can be answered: Pass, Fail, None of the Above.

I need a button at the end which will look at each question and if all are a Pass or a "None of the Above", it will then update the record and save.

If there are any fails, then the record updates a bit differently.

I have written the following and just need to figure out how to make "update" pieces work.

If([QA01a]="Pass" and [QA02a]="Pass" and [QA03a]="Pass" and [QA04a]="Pass" and [QA05a]="Pass" and [QA06a]="Pass" and [QA07a]="Pass" and [QA08a]="Pass" and [QA09a]="Pass" and [QA10a]="Pass" and [QA11a]="Pass" and [QA12a]="Pass" and [QA13a]="Pass" and [QA14a]="Pass" and [QA15a]="Pass" and [QA16a]="Pass" and [QA17a]="Pass" and [QA18a]="Pass" and [QA19a]="Pass" and [QA20a]="Pass" and [QA21a]="Pass" and [QA22a]="Pass" and [QA23a]="Pass" or [QA01a]="None of the Above" or [QA02a]="None of the Above" or [QA03a]="None of the Above" or [QA04a]="None of the Above" or [QA05a]="None of the Above" or [QA06a]="None of the Above" or [QA07a]="None of the Above" or [QA08a]="None of the Above" or [QA09a]="None of the Above" or [QA10a]="None of the Above" or [QA11a]="None of the Above" or [QA12a]="None of the Above" or [QA13a]="None of the Above" or [QA14a]="None of the Above" or [QA15a]="None of the Above" or [QA16a]="None of the Above" or [QA17a]="None of the Above" or [QA18a]="None of the Above" or [QA19a]="None of the Above" or [QA20a]="None of the Above" or [QA21a]="None of the Above" or [QA22a]="None of the Above" or [QA23a]="None of the Above", "Pass", 'Fail")



//WHEN PASS DO THIS:
var text CheckBox =
URLRoot() & "db/" & [_DBID_STATEMENT_JOB_HISTORY]  
& "?act=API_EditRecord&rid=" 
& [Record ID#] & "&_fid_93=true";

var text EditRecord =
URLRoot() & "db/" & [_DBID_STATEMENT_JOB_HISTORY]  
& "?act=API_EditRecord&rid=" 
& [Record ID#] & "&_fid_94=" & ToText(User())
& "&_fid_95=" & ToText(Now())
& "&_fid_90=In QC - 2nd Check"
& "&_fid_166=In QC - 2nd Check"
& "&_fid_167=In QC - 2nd Check"
& "&_fid_168=In QC - 2nd Check"; 

var text DisplayParent = 
URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$CheckBox
& "&rdr=" & URLEncode($EditRecord)
& URLEncode("&rdr=" & URLEncode ($DisplayParent))




//WHEN FAIL DO THIS:
var text EditRecord =
URLRoot() & "db/" & [_DBID_STATEMENT_JOB_HISTORY]  
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_166=FAILED 1st Check"
& "&_fid_179="
& "&_fid_183="
& "&_fid_93="
& "&_fid_28="
& "&_fid_29="
& "&_fid_30="
& "&_fid_31="
& "&_fid_32="
& "&_fid_33="
& "&_fid_34="
& "&_fid_35="
& "&_fid_36="
& "&_fid_37="
& "&_fid_38="
& "&_fid_39="
& "&_fid_40="
& "&_fid_41="
& "&_fid_42="
& "&_fid_43="
& "&_fid_44="
& "&_fid_45="
& "&_fid_46="
& "&_fid_47="
& "&_fid_48="
& "&_fid_49="
& "&_fid_50="
& "&_fid_51="
& "&_fid_52="
& "&_fid_53="
& "&_fid_54="
& "&_fid_55="
& "&_fid_56="
& "&_fid_57="
& "&_fid_58="
& "&_fid_59="
& "&_fid_60="
& "&_fid_61="
& "&_fid_62="
& "&_fid_63="
& "&_fid_64="
& "&_fid_65="
& "&_fid_66="
& "&_fid_67="
& "&_fid_68="
& "&_fid_69="
& "&_fid_70="
& "&_fid_71="; 

var text DisplayParent = 
URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$EditRecord
& "&rdr=" & URLEncode($DisplayParent)
Photo of Jen Latkowski

Jen Latkowski

  • 80 Points 75 badge 2x thumb
  • Confused

Posted 4 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,306 Points 50k badge 2x thumb
Jen,

Try this

//WHEN PASS DO THIS:
var text CheckBox =
URLRoot() & "db/" & [_DBID_STATEMENT_JOB_HISTORY]  
& "?act=API_EditRecord&rid=" 
& [Record ID#] & "&_fid_93=true";

var text EditRecord =
URLRoot() & "db/" & [_DBID_STATEMENT_JOB_HISTORY]  
& "?act=API_EditRecord&rid=" 
& [Record ID#] & "&_fid_94=" & ToText(User())
& "&_fid_95=" & ToText(Now())
& "&_fid_90=In QC - 2nd Check"
& "&_fid_166=In QC - 2nd Check"
& "&_fid_167=In QC - 2nd Check"
& "&_fid_168=In QC - 2nd Check"; 

var text DisplayParent = 
URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];


var text PASS = $CheckBox
& "&rdr=" & URLEncode($EditRecord)
& URLEncode("&rdr=" & URLEncode ($DisplayParent));




//WHEN FAIL DO THIS:
var text EditRecord =
URLRoot() & "db/" & [_DBID_STATEMENT_JOB_HISTORY]  
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_166=FAILED 1st Check"
& "&_fid_179="
& "&_fid_183="
& "&_fid_93="
& "&_fid_28="
& "&_fid_29="
& "&_fid_30="
& "&_fid_31="
& "&_fid_32="
& "&_fid_33="
& "&_fid_34="
& "&_fid_35="
& "&_fid_36="
& "&_fid_37="
& "&_fid_38="
& "&_fid_39="
& "&_fid_40="
& "&_fid_41="
& "&_fid_42="
& "&_fid_43="
& "&_fid_44="
& "&_fid_45="
& "&_fid_46="
& "&_fid_47="
& "&_fid_48="
& "&_fid_49="
& "&_fid_50="
& "&_fid_51="
& "&_fid_52="
& "&_fid_53="
& "&_fid_54="
& "&_fid_55="
& "&_fid_56="
& "&_fid_57="
& "&_fid_58="
& "&_fid_59="
& "&_fid_60="
& "&_fid_61="
& "&_fid_62="
& "&_fid_63="
& "&_fid_64="
& "&_fid_65="
& "&_fid_66="
& "&_fid_67="
& "&_fid_68="
& "&_fid_69="
& "&_fid_70="
& "&_fid_71="; 

var text DisplayParent = 
URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

var text EDIT  = $EditRecord
& "&rdr=" & URLEncode($DisplayParent)



IF([my pass / fail field] = "Pass", $PASS, $FAIL)

Note that you will need to disable Application Tokens or else add a line of code to each edit.

& " &apptoken=xxxxxxxxx' where xxxxx is the application token.
Photo of Jen Latkowski

Jen Latkowski

  • 80 Points 75 badge 2x thumb
Thank you! I will give this a whirl.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,306 Points 50k badge 2x thumb
Also your pass fail formula calculation is probably flawed ... I think that you will need some  ( brackets) around your OR conditions.