Hallo,
I would like to build a multilingual form. 4 languages stored inside one single PDF. The language should be changed with a dropdown Button.
I added in the XML view the attributes like the following.
My question:
It would be great If somebody could help me. I tryed this script from this grat blog, the result'll be the same, but I guess that working with the xml:lang element it's a better way to mantain a single multilang PDF.
Thank you for every help I get.
alex
Views
Replies
Total Likes
Hi,
the xml:lang attribute is ignored by XFA I'm afraid.
http://partners.adobe.com/public/developer/en/xml/xfa_spec_3_3.pdf#page=152
Views
Replies
Total Likes
Here is another solution for you:
- create 4 check-boxes (EN, FR, DE, IT), each in it's own subform - set as repeater, with minimum 0;
- on "change" event of the drop-down you set the instance to 1 for the subform which contains the check-box you are interested in and instance 0 for the rest;
- this will work and is easy to maintain in future, but when you change the language (and instances are added/removed) the check-boxes will be reset (if the user selects the check-box and then changes the language).
If this method does not help you, tell me and maybe I can think of something else.
From experience, messing with the XML as you are trying to do is never a good idea.
Views
Replies
Total Likes
Hallo, thank you for your help.
In Life Cycle I wasn't able to set up the scripting but I reached the aim using Adobe InDesign.
//read quantity of layer and create array
var layers = this.getOCGs();
//lock system layers
for(var i=0;i<this.layers.length;i++)
{
//visibility of layers
if(layers[i].name == "deutsch")
layers[i].state = false;
if(layers[i].name == "italiano")
layers[i].state = false;
if(layers[i].name == "francais")
layers[i].state = false;
if(layers[i].name == "english")
layers[i].state = true;
}
If you want to take a look on my solution, here is the PDF with buttons:
https://cloud.technoalpin.com/public.php?service=files&t=e68f345052968b17257e1d227b7b5687
If you want to take a look on my solution, here is the PDF with dropdown:
https://cloud.technoalpin.com/public.php?service=files&t=f2f61d880384909b3a3cf2aabdc6c475
It's possible to get a similar result in Lifecycle Designer too ? This because in this way I only use one Software not two and the performance is much better.
Best regards
alex
Here the code for the dropdown button named "language". You must copy the code in the section CUSTOM CALCULATION FIELD.
In the PDF you must have the named layers
//read quantity of layer and create array
var layers = this.getOCGs();
//lock system layers
for(var i=0;i<this.layers.length;i++)
{
//if(layers[i].name == "button")
//layers[i].locked = true;
if(layers[i].name == "form")
layers[i].locked = true;
if(layers[i].name == "background")
layers[i].locked = true;
}
//read value of combobox
event.value = this.getField("language").value;
//make choise
switch(event.value){
case "deutsch":
//app.alert ("deutsch", 3);
//find layer by names in array
for(var i=0;i<this.layers.length;i++)
{
//visibility of layers
if(layers[i].name == "deutsch")
layers[i].state = true;
if(layers[i].name == "italiano")
layers[i].state = false;
if(layers[i].name == "francais")
layers[i].state = false;
if(layers[i].name == "english")
layers[i].state = false;
}
break;
case "italiano":
//app.alert ("italiano", 3);
for(var i=0;i<this.layers.length;i++)
{
//visibility of layers
if(layers[i].name == "deutsch")
layers[i].state = false;
if(layers[i].name == "italiano")
layers[i].state = true;
if(layers[i].name == "francais")
layers[i].state = false;
if(layers[i].name == "english")
layers[i].state = false;
}
break;
case "francais":
//app.alert ("francais", 3);
for(var i=0;i<this.layers.length;i++)
{
//visibility of layers
if(layers[i].name == "deutsch")
layers[i].state = false;
if(layers[i].name == "italiano")
layers[i].state = false;
if(layers[i].name == "francais")
layers[i].state = true;
if(layers[i].name == "english")
layers[i].state = false;
}
break;
case "english":
//app.alert ("english", 3);
for(var i=0;i<this.layers.length;i++)
{
//visibility of layers
if(layers[i].name == "deutsch")
layers[i].state = false;
if(layers[i].name == "italiano")
layers[i].state = false;
if(layers[i].name == "francais")
layers[i].state = false;
if(layers[i].name == "english")
layers[i].state = true;
}
break;
}
Views
Replies
Total Likes
To avoid counting the elements on every iteration, replace this line
for(var i=0;i<this.layers.length;i++)
with this line
for(var i=0,j=this.layers.length;i<j;i++)
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies