Hello,
When I execute the following code:
FormField newField = new FormField("MyNewField");
newField.Value = "Dynamic";
The value of the new field is not set. Is there something else that I need to be doing?
Assigning Values to New FormFields
Re: Assigning Values to New FormFields
Support · Apr 23, 2007Hello,
In order to add form field and to fill the form field you will have to use the following code.
Document doc = new Document();
Page page = new Page();
TextField t1 = new TextField("text",0,0,100,20);
t1.DefaultValue = "ceTe Software";
page.Elements.Add(t1);
doc.Pages.Add(page);
doc.DrawToWeb();
Thanks,
ceTe Software Support Team.
Re: Assigning Values to New FormFields
Forum member · Apr 23, 2007Hello,
When I try to create a new TextField, I get the following error:
Error 1 Cannot create an instance of the abstract class or interface 'ceTe.DynamicPDF.Forms.TextField'
Is the code you show referencing TextField in a different namespace than the one I'm trying to use?
Thanks.
Re: Assigning Values to New FormFields
Forum member · Apr 23, 2007It is becoming more and more apparent that there is either a bug in the manipulation of fields in the ceTe.DynamicPDF.Forms namespace, or that the code allows compilation of code whose functionality is not supported.
Again, when I attempt to execute the following:
FormField subformField = mergeDoc.Form.Fields[0].ChildFields[0].ChildFields[1];
subformField.ChildFields[0].Value = "Assign value to existing field in subform.";
ceTe.DynamicPDF.Forms.FormField formField = new FormField("NewFormField");
formField.Value = "Dynamic Text Value";
subformField.ChildFields.Add(formField);
Not only does formField's value not get updated, but when I call document.Draw() to save the pdf file and then reopen it with Merger, the recently-added field is nowhere to be found.
I am in the process of purchasing this software under the assumption that these actions are supported. If they are not, I am going to be extremely disappointed and may have to move in a different direction.
Re: Assigning Values to New FormFields
Support · Apr 23, 2007The tasks in which it looks like you are trying to accomplish (1. Fill out an existing form field and 2. Add a new form field) can be done with our product. We have not experienced or heard of any issue relating to either of these functionalities.
From the code you posted it looks like you are attempting to add a new form field to the document by instantiating a ceTe.DynamicPDF.Forms.FormField object and adding it to the form field's child field collection. When actually you instead want to create a ceTe.DynamicPDF.PageElements.Forms.TextField object and add it to the appropriate Page.
Give this a try using this method and you should find success. As for the filling out of the existing form field the code you posted above looks correct. If you are still having trouble with filling out your PDF or with adding the new form field you can send over the PDF you are using (along with the exact code you are running) to [^a|mailto:support@cete.com|support@cete.com^] and we will be able to take a closer look at this.
Thanks,
ceTe Software Support Team