Minimum and Maximum Calculations


hi everyone,

 

most tasked change our formulas excel , make them usable in pdf format (adobe acrobat x in windows vista). generally, these formulas max , min functions , based on users input fires action returns pass or fail condition.

 

the "pass" condition returned long users input in between max , min. if users input out of min , max ceiling return "fail". problem i'm not sure how aproach javascript in pdf form and/or if need too? i'll try , explain i'm trying accomplish here;

 

currently have 4 text fields:

 

  • text field 1 holds min value.
  • text field 2 holds max value.
  • text field 3 hold input value.
  • text field 4 returns "pass" or "fail" based on input.

 

i'm assuming javascript, should able apply following;

 

var m1 = getfield("text1").value; //gets minumum value

var m2 = getfield("text2").value; //gets maximum value

var m3 = getfield("text3").value; //gets input value

 

here i'm lost not know or how apply; (i may have wrong).

 

text4 = m4

 

if m3 >= m1 , m3 <= m2 m4 = {"pass"}

     elseif m3 < m1 , m3 > m2  m4 = {"fail"}

 

thank you!

try m4 field's custom calculate script:

 

(function () {

 

    // field values, numbers

    var m1 = +getfield("text1").value;

    var m2 = +getfield("text2").value;

    var m3 = +getfield("text3").value;

 

    // set field's value

    if (m3 < m1 || m3 > m2) {

        event.value = "fail";

    } else {

        event.value = "pass";

    }

 

})();

 

 

you can replace if/else block above following equivalent statement:

 

event.value = m3 < m1 || m3 > m2 ? "fail" : "pass";



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support