Fillable Form from Dataset
I have been tasked with the process of altering a fillable pdf form at work. The purpose of this form is for an employee here at the office to run this application and to select a proposal and it populate a list of classifications and wage rates, save the pdf form and then they can email that form to users in the field to fill out and return.
I am not really that familiar with fillable pdf forms but as a programmer feel I can handle it. The form I am trying to populate contains three columns; a classification field that I populate with selected dropdown items (I found this easy) and then an Hourly Rate Paid column that I am trying to populate dynamically when they select a classification and a number of employees column that they enter manually.
What I need the form to do is when a classification is selected from the dropdown (by the user in the field) the form is supposed to look through a dataset of some type and find that classification along with its related wage rate and then automatically populate the hourly rate paid. Everything I have read says if the users using the form aren't local then using a database isn't the best option. So, I thought on the original generating of the fillable pdf form, by the employee in the office, that I could query the database, store the data locally some how whether a dataset or a temp table or something and then when the user in the field gets the form and selects a classification that it uses that local table/dataset to find that value.
I am able to create a temp table in the vb code of the application but have no idea how to call that table within the javascript editor.
Here is the function I wrote for pulling the data into a local table
Private Function Classifications_values(ByVal classifications As List(Of Model.V_WAGE_DECISIONS))
Dim classification_value As New DataTable
classification_value.Columns.Add("Classification")
classification_value.Columns.Add("Value")
For Each i In classifications
Dim itm As Model.V_WAGE_DECISIONS = i
Dim row As DataRow = classification_value.NewRow
row(0) = i.DESCR
row(1) = i.WAGE_RATE
classification_value.Rows.Add(row)
Next
Dim ds As New DataSet
ds.Tables.Add(classification_value)
Return ds
End Function
And in javascript of the pdf form I set up a document JavaScript called SetFieldValues and did this:
function SetFieldValues(classification)
{
this.getField("Hourly Rate Paid").value = classification_value[classification].Value;
}
If I replace "classification_value[classification].Value" with the number 12 it works perfectly but it won't query the table/dataset.
Any suggestions would be appreciated. Thanks!
