[Solved] Form in a Template

Using them, Making them, Finding them
Post Reply
User avatar
cesarakg
Posts: 5
Joined: Mon Oct 20, 2008 4:09 pm
Location: Candelaria - Brazil

[Solved] Form in a Template

Post by cesarakg »

Hello

I have a somewhat complex problem. I need to fill two different forms and save them with the values filled. I think I can use forms + template.

I created a template with two pages (one for each form), put fields in both pages, and protected the document, so user can only fill the fields in the created document. There are repeated information in both forms. I don't wanna fill the same information twice. If I was using Word, I would include a calculated field and include the reference for the other field, and make the field "read-only", but appears that I have to program a macro in OOo, is that right?

I found a tutorial (http://www.softwarelivre.gov.br/protoco ... rativa.pdf - in portuguese) that uses a dialog box :super: and a complement :crazy: that must be installed and uses a template that must be put in some known place :crazy:, and that uses macro programming. If I can put the macros in the template, excellent. If I can't use a dialog box this way, but can use a form, fine.


My questions:

1. can I use a dialog to fill the form, in a way that the dialog is called only when a new document is created from the template? If someone opens the created document, it will be only for reading or printing purposes, so it's better if the newly created document becames "read-only".

2. how I copy the info from one field to other field? Macro programming? Or I should use "bookmarks" instead of fields?

3. The form I created have a problem, if I use TAB it navigates only in the first page, I have to manually jump to the first field on the second page. After that, the TAB navigation works as a charm, jumping from one page to another. Is there a way to correct this? The less the user has to use the mouse, the better.

If you need an example to think, it can be something like:

(first page, form 1)
Drive permit: [drive permit #]
Name: [name]
Date: [date emission]

In signing this Agreement I hereby acknowledge my acceptance of an agreement with some suspicious corporation or government agency.

__________________
[name], Date.


(second page, form 2)

Permission number [permission number]/2013 Valid until [valid until date]
Name: [name] Drive permit: [drive permit #]
Address: [address line]
City: [city name] ZIP: [zip code]

(end of document)


In this example the user will fill "drive permit #", "name", "date emission", "permission number", "valid until date", "address line", "city name", and "zip code", and the first two fields are repeated in both forms.

Thanks for your time, and sorry for the bad english.
Last edited by cesarakg on Thu Dec 12, 2013 9:36 pm, edited 1 time in total.
OOo 2.3.X on Ubuntu 8.x + Windows XP
BROffice 3.3.0 on Windows XP
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: Form in a Template

Post by JohnV »

You don't need a macro for this. You can use variables, the value of which the user will be queried for.

Open a new Writer document and first do Insert > Section, click into the section and enter any text that you want to be protected. Click underneath the section and do Ctrl+Enter to open page 2. Repeat the above for page 2.

Click back in the page 1 section an put your cursor where you want the Name variable. Do Insert > Fields > Other > Variable tab, select User Field in the Type column and Text in the Format column. Enter Name in the Name box, leave the Value box empty and click the green arrow. Now we want to insert Name in the section as an Input Field which is what will cause the user to be queried for its content. Select Input Field in the type column and Name in the Selection column. In the Reference box type a prompt like "Enter your name.", then click Insert and OK. Repeat for each variable.

Put you cursor where you need a second copy of any of the variables, do Insert > Fields > Other > Variable tab, select User Field in the Type column, the variable name in the Selection column and click insert. Note that you only want a variable inserted once as an Input field or the user will be prompted more than once for it content.

When the document is completed go to the Navigator (F5), right click your sections > Edit and Protect them. Now save your document as a template and close it. When opened (not from recently used) you will be prompted for the value of all variables. If the user makes a mistake and needs to change the content of a variable then he can do so by single clicking an input field or double clicking a user field. FWIW, Ctrl+Shift+F9 will reprompt for all input fields.
User avatar
cesarakg
Posts: 5
Joined: Mon Oct 20, 2008 4:09 pm
Location: Candelaria - Brazil

Re: Form in a Template

Post by cesarakg »

Worked as advertised :bravo:

Ctrl+Shift+F9 asks for the field values again, but messes with the document - instead of showing the field values, it shows "User Field <the name of the field>" *this was the result of a Ctrl+F9* *sigh* (I used a total of 12 fields). And it works asking one field each after another. I will try adding a new section, unprotected, where I can enter the variable's values navigating through formated fields. If you have any other ideas, please...

Again, sorry for the bad english.

Edited...
OOo 2.3.X on Ubuntu 8.x + Windows XP
BROffice 3.3.0 on Windows XP
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: Form in a Template

Post by JohnV »

I take it that you solved your problem (Ctrl+F9) and need no further assistance. If not, let us know.
User avatar
cesarakg
Posts: 5
Joined: Mon Oct 20, 2008 4:09 pm
Location: Candelaria - Brazil

Re: Form in a Template

Post by cesarakg »

The Ctrl+F9 part was solved. I need only to do some thinking about my forms, but I think it's solved for this issue.

Thanks!
OOo 2.3.X on Ubuntu 8.x + Windows XP
BROffice 3.3.0 on Windows XP
Post Reply