Expand my Community achievements bar.

Formcalc to javacript

Avatar

Former Community Member

Hi,

  I´ve got formcalc expression: form.page1.ident.Table.Row1.subform.RadioButtonList.aperson.validate.nullTest = "error" . But because the rest of the script is Javascript, I need thit expression summon in js.

Could somebody hint me? I am off on Friday

10 Replies

Avatar

Former Community Member

That expression is the same in FormCalc and Javascript

Paul

Avatar

Former Community Member

Thanx, at least this is ok.

I am using this script:

form.page1.ident.Table.Row1.subform.RadioButtonList::initialize - (JavaScript, client)

var oState = event.target.getField("form[0].page1[0].sig[0].signature[0]").signatureInfo().status;
if (oState == 0) {
    app.alert("The Signature is missing");
  }
 
form.page1.ident.Table.Row1.subform.RadioButtonList.aperson.validate.nullTest = "error"
form.page1.ident.Table.Row1.subform.RadioButtonList.bperson.validate.nullTest = "error"
form.page1.ident.Table.Row1.subform.RadioButtonList.cperson.validate.nullTest = "error"

Upper part is working fine. Lower part not. If I delete upper part, the rest is working fine.

Avatar

Former Community Member

What is the error you are recieving ....In Acrobat hit Ctrl-J to bring up the Java console. All errors are reported there.

Paul

Avatar

Former Community Member

this is from Designer log, or should I try it in Acrobat?

Script failed (language is javascript; context is xfa[0].form[0].form[0].page1[0].ident[0].Table[0].Row1[0].subform[0].RadioButtonList[0])
script=
var oState = event.target.getField("form[0].page1[0].sig[0].signature[0]").signatureInfo().status; // Get the current field's signed state.
if (oState == 0) {
    app.alert("The Signature is missing");
  }
 
form.page1.ident.Table.Row1.subform.RadioButtonList.aperson.validate.nullTest = "error"
form.page1.ident.Table.Row1.subform.RadioButtonList.bperson.validate.nullTest = "error"
form.page1.ident.Table.Row1.subform.RadioButtonList.cperson.validate.nullTest = "error"
   Error: null is not an object

Avatar

Former Community Member

I moved these part into IF and still not working.

var oState = event.target.getField("form[0].page1[0].sig[0].signature[0]").signatureInfo().status; // Get the current field's signed state.
if (oState == 0) {
    form.page1.ident.Table.Row1.subform.RadioButtonList.aperson.validate.nullTest = "error";
form.page1.ident.Table.Row1.subform.RadioButtonList.bperson.validate.nullTest = "error";
form.page1.ident.Table.Row1.subform.RadioButtonList.cperson.validate.nullTest = "error";
    app.alert("The Signature is missing");
  }

Alert beeps when running (in Acrobat, oState equals zero in debugger) , no error. Somehow jumped over these clauses, or what.

Avatar

Former Community Member

Can you post the form ...it is always easier debugging when you can see what is happening.

Paul

Avatar

Former Community Member

or just if you can give an email , I will send you that example...

thanks in advance