2 Replies Latest reply on Mar 19, 2008 5:05 AM by gkaiseril

    Programmatically adding action to button

      I have tried to programmatically add javascript to an Acrobat button, as follows (using APToolkitNet):

      FieldInfo fi = toolKit.FieldInfo( "ButtonX" ,1 );
      fi.MouseUpScript = "app.alert('hello world')"; //OR
      fi.JavaScript = "app.alert('hello world')";

      I run my code, and this script does get added to my form javascripts. The problem is, they are being added as being a type of Calculation, as follows:

      //<AcroForm>
      //<ACRO_source>ButtonX:Calculate</ACRO_source>
      //<ACRO_script>
      /*********** belongs to: AcroForm:ButtonX:Calculate ***********/
      app.alert('hello world')
      //</ACRO_script>
      //</AcroForm>

      When it should be (i.e. this is what occurs when you manually add the javascript):

      //<AcroForm>
      //<ACRO_source>ButtonX:Annot1:MouseUp:Action1</ACRO_source>
      //<ACRO_script>
      /*********** belongs to: AcroForm:ButtonX:Annot1:MouseUp:Action1 ***********/
      app.alert('hello world')
      //</ACRO_script>
      //</AcroForm>

      Can anyone help me???

      Thanks