Expand my Community achievements bar.

medium.long doesnt work

Avatar

Former Community Member
why does this not work to set the pagesize?



javascript:

FormE46.pageSet.Page1.medium.long = "33in";



herbert
10 Replies

Avatar

Former Community Member
Herbert,



You can set the page size to be custom and define the size, but I don't believe that you can set the page size at runtime through script.



Catherine

Avatar

Former Community Member
catherine,



the XML Form Object Model 2.2 Reference:



long

Specifies the length of the long edge of the medium.

The length specified by the long property must be greater than the length specified by the short property.



Applies to:

Form Model : medium

Template Model : medium



Examples

FormCalc

$.pageSet.Page1.medium.long = "15in"



if i try

FormE46.pageSet.Page1.medium.long = "33in"; i always get the error message:



SyntaxError: missing name after . operator

4:XFA:FormE46[0].SchadenMeldung[0].header[0]:initialize



regards

herbert

Avatar

Former Community Member
Are you writing: FormE46.pageSet.Page1.medium.long = "33in"; in javascript?



Catherine

Avatar

Former Community Member
Herbert,



In Javascript "long" is a reserved word, like "if" and "while", used to describe a variable or data. The script that you are using should work in FormCalc like the reference indicates but not in Javascript.



Catherine

Avatar

Former Community Member
hi catherine,



thanks, i will try it using formcalc.



best regards

herbert

Avatar

Former Community Member
Hi Herbert, hi all,



Herbert: have you solved this issue finally?



I'm trying to toggle the pagesize (height) for my 3-page dynamic form and get rid of page breaks while the user fills the form (Same feel as a web page). For printing I would toggle back to A4 pagesize (297mm).



I put this in the click event of a button:



console.println("1. medium.long="+Form.pageSet.Seite1.medium.getAttribute("long"));

Form.pageSet.Seite1.medium.setAttribute("997mm", "long");

console.println("2. medium.long="+Form.pageSet.Seite1.medium.getAttribute("long"));

xfa.layout.relayout();

xfa.layout.relayoutPageArea(0);

console.println("3. medium.long="+Form.pageSet.Seite1.medium.getAttribute("long"));



and get this output:



1. medium.long=297mm

2. medium.long=997mm

3. medium.long=297mm



I'am able to modify the pagesize, but nothing happens. If I relayout, pagesize will be like before.



Any hints how I may get this working?



Thanks,

Kolja

Avatar

Former Community Member
If anyone is interested, I have solved this one for me:



The solution is to change the page layout in the template and then relayout, which changes it in the visible form as well:



xfa.template.Form.pageSet.Seite1.medium.setAttribute("997mm", "long");

xfa.layout.relayout();

xfa.layout.relayoutPageArea(0);



Bye,

Kolja

Avatar

Former Community Member
This discussion has really intrigued me. I had not thought of doing this. Is this last bit of code part of the original code above or is it by itself in a click event for a button? I have a form that is suppose to grow as more text is entered in a field and this idea of making it work like a web page when filling out the form but then breaking it up to fit on printed pages might just work very nice. Since I'm still fairly new to scripting in Designer it's going to take a bit of work in figuring out how you are getting this to work and how I can get it to work with my stuff.

Avatar

Former Community Member
Hi,



I need to do the same in my form.

I have this approach:

pageSet.Page1 has medium.stock = "legalExtra"

and medium.orientation = "landscape" at design time



At runtime, upon click of a button I am doing the following:

xfa.template.myForm.pageSet.Page1.medium.setAttribute("a4Extra", "stock")

xfa.template.myForm.pageSet.Page1.medium.setAttribute("landscape", "orientation")

xfa.layout.relayout()

xfa.layout.relayoutPageArea(0)



my form has multiple pages at runtime.



I used xfa.host.messageBox to get medium.stock and medium.orientation. It returns a4Extra and lanscape but nothing happens to the form



I have Designer 7.1

Avatar

Former Community Member
Setting Long and Short attributes works perfect.. I wonder why stock and orientation don't??!!?!?!?