A unique form field identifier specifying a required form field object. You can obtain this identifier using methods like GetFormFieldId, GetFormFieldChildID or methods intended to add form fields.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetFormFieldActionID Method

GetFormFieldActionID Method (GdPicturePDF)

In This Topic
Returns the action's unique identifier of the action associated with a form field, that is specified by its unique form field's identifier and it is related to the currently loaded PDF document. You can subsequently use the GetActionType method to determine the kind of this action.

At this time it is supported by the toolkit to only associate one action within one form field.

Syntax
'Declaration

 

Public Function GetFormFieldActionID( _

   ByVal FieldId As Integer _

) As Integer
public int GetFormFieldActionID( 

   int FieldId

)
public function GetFormFieldActionID( 

    FieldId: Integer

): Integer; 
public function GetFormFieldActionID( 

   FieldId : int

) : int;
public: int GetFormFieldActionID( 

   int FieldId

) 
public:

int GetFormFieldActionID( 

   int FieldId

) 

Parameters

FieldId
A unique form field identifier specifying a required form field object. You can obtain this identifier using methods like GetFormFieldId, GetFormFieldChildID or methods intended to add form fields.

Return Value

A unique action identifier of the action associated with a specified form field. The GetStat method can be subsequently used to determine if this method has been successful.

You can use the GetActionType method to obtain the type of this action, as it is shown in the example below.

Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Be aware that at this time it is not supported by the toolkit to add multiple actions per one form field.

Example
How to find out the types of actions associated with form fields in the currently loaded PDF document.
Dim caption As String = "Example: GetFormFieldActionID"

Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()

If gdpicturePDF.LoadFromFile("forms.pdf", False) = GdPictureStatus.OK Then

    Dim count As Integer = gdpicturePDF.GetFormFieldsCount()

    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

        Dim message As String = ""

        Dim formID As Integer = 0, actionID As Integer = -1

        Dim type As PdfFormFieldType = PdfFormFieldType.PdfFormFieldTypeUnknown

        Dim actionType As PdfActionType = PdfActionType.ActionTypeUnknown

        For i As Integer = 0 To count - 1

            formID = gdpicturePDF.GetFormFieldId(i)

            If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

                message = message + (i + 1).ToString() + ".field's type: "

                type = gdpicturePDF.GetFormFieldType(formID)

                If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

                    message = message + type + "  action: "

                    actionID = gdpicturePDF.GetFormFieldActionID(formID)

                    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

                        actionType = gdpicturePDF.GetActionType(actionID)

                        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

                            message = message + actionType.ToString()

                        Else

                            message = message + gdpicturePDF.GetStat().ToString()

                        End If

                    Else

                        message = message + gdpicturePDF.GetStat().ToString()

                    End If

                Else

                    message = message + gdpicturePDF.GetStat().ToString()

                End If

                message = message + vbCrLf

            Else

                message = message + "The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString()

                Exit For

            End If

        Next

        If count = 0 Then message = "This file doesn't include forms."

        MessageBox.Show(message, caption)

    Else

        MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)

    End If

Else

    MessageBox.Show("The file can't be loaded.", caption)

End If

gdpicturePDF.Dispose()
string caption = "Example: GetFormFieldActionID";

GdPicturePDF gdpicturePDF = new GdPicturePDF();

if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)

{

    int count = gdpicturePDF.GetFormFieldsCount();

    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

    {

        string message = "";

        int formID = 0, actionID = -1;

        PdfFormFieldType type = PdfFormFieldType.PdfFormFieldTypeUnknown;

        PdfActionType actionType = PdfActionType.ActionTypeUnknown;

        for (int i = 0; i < count; i++)

        {

            formID = gdpicturePDF.GetFormFieldId(i);

            if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

            {

                message = message + (i + 1).ToString() + ".field's type: ";

                type = gdpicturePDF.GetFormFieldType(formID);

                if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

                {

                    message = message + type + "  action: ";

                    actionID = gdpicturePDF.GetFormFieldActionID(formID);

                    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

                    {

                        actionType = gdpicturePDF.GetActionType(actionID);

                        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

                            message = message + actionType.ToString();

                        else

                            message = message + gdpicturePDF.GetStat().ToString();

                    }

                    else

                        message = message + gdpicturePDF.GetStat().ToString();

                }

                else

                    message = message + gdpicturePDF.GetStat().ToString();

                message = message + "\n";

            }

            else

            {

                message = message + "The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString();

                break;

            }

        }

        if (count == 0) message = "This file doesn't include forms.";

        MessageBox.Show(message, caption);

    }

    else

        MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);

}

else

    MessageBox.Show("The file can't be loaded.", caption);

gdpicturePDF.Dispose();
See Also