- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi Malcolm....I got it sorted and it now works...I made a few rookie mistakes and I was able to figure it out this morning. (Maybe I just needed a clear head today...wasted so much time banging my head yesterday but I was able to identify the mistakes today! funny how that works..lol)
These are the mistakes I did:
1) When I first tried your code with 1 textfield, I changed that field from "rich text" to "plain text" in order for this script to work. However, when I modified this script to do the same for the other textfields, I forgot to change the remaining fields to "plain text" as well...sounds silly now, but I totally missed this one yesterday! Since I am still getting used to jscripts, when it wasnt working I straight away thought it was my script at fault. Need to have more confidence on myself I guess.. ![]()
2) I also made a small mistake in the script as well. Instead of adding the loop "i" for the rows, I added it to the textfields which wasnt right. Thats why the font size of the row's instances werent changing..I needed to add "resolveNode("Row1["+i+"]")" instead of "Row1". So I now changed the script to this and now it works perfectly!
//This code is for the "+" button
// get font size
var currentSize = xfa.resolveNode("xfa.form.form1.pageSubform.dynamicSubform.Table1.Row1.column1Subform.Textfield1").font.size;
// get location of the "pt" string
var ptPlace = currentSize.indexOf("pt");
// get the part of the string that is just numbers
var currentSizeInt = currentSize.substr(0,ptPlace);
// parse that new string as an integer and add 1
var newSizeInt = parseInt(currentSizeInt, 10) + 1;
// set that as the new font size ( adding the "pt" back on)
//and also do the same of all its instances.
//First counting the number of dynamic rows
var countRows = form1.pageSubform.dynamicSubform.Table1.Row1.instanceManager.count;
//loop to set new font size to this textfield and all its instances
for(var i=0; i<countRows; i++){
form1.pageSubform.dynamicSubform.Table1.resolveNode("Row1["+i+"]").column1Subform.Textfield1.font.size = newSizeInt + "pt";
//here doing the same for the textfields in other columns
form1.pageSubform.dynamicSubform.Table1.resolveNode("Row1["+i+"]").column2Subform.Textfield1.font.size = newSizeInt + "pt";
form1.pageSubform.dynamicSubform.Table1.resolveNode("Row1["+i+"]").column3Subform.Textfield1.font.size = newSizeInt + "pt";
form1.pageSubform.dynamicSubform.Table1.resolveNode("Row1["+i+"]").column4Subform.Textfield1.font.size = newSizeInt + "pt";
form1.pageSubform.dynamicSubform.Table1.resolveNode("Row1["+i+"]").column5Subform.Textfield1.font.size = newSizeInt + "pt";
}
I'm so glad its working now...Its a good start of my morning today!
Thank you so much for your support and guiding me through this Malcolm! Much appreciated! ![]()
Cheers!
Views
Replies
Total Likes