Page 1 of 1

How to refresh (update) after change Default in form field?

PostPosted: Wed Jul 06, 2011 12:55 am
by trematodeo
Hello all!

I need to fill some form fields programatically and leave others to be filled by the user. Then I found two ways to do this:

1- Change the "Default" value in the form text field. The problem is when the user open this doc (downloaded from a browser) the default value isn't visible, if I open the properties of this field I can see the default value. If I click in "ok" button the default is applied. How I can force this in a way that when the user open the docx all default fields are already there?

Code: Select all
if(element.getValue() instanceof CTFFTextInput){
    Default d = new Default();
    d.setVal("test");
    if(((CTFFTextInput)element.getValue()).getDefault()!=null)
        ((CTFFTextInput)element.getValue()).getDefault().setVal("test");
    else
   ((CTFFTextInput)element.getValue()).setDefault(d);
}



2- Transverse the doc and find the place where the texts inserted by the user normally stay and then fill there. Now when the user open the docx they can see all the fields filleds. But doing in this way the properties of the field isn't applied (max length, format, etc). How to force this? Only to remember, now I'm nothing filling inside the FldChar tag but in a Text after that (I found the exactly point filling one field in word editor and than openning the xml file to see where the text are).

Code: Select all
Text t1 = (Text)element.getValue();
t1.setValue("test");


Thanks !!! :D