field width or height

1,246 views
Skip to first unread message

Falor, Brian

unread,
Mar 18, 2010, 2:21:18 PM3/18/10
to live...@googlegroups.com

Does anyone happen to know of a JS code that will extract the width or height value of a field?  For example, if I have a field height set up for “Expand to fit” and I want to extract the actual height of that field so that I can programmatically make an adjacent field the same height, is there a way to do this?

 

_____________________________________

Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958
GES_tag_horizontal
www.ges.com | bfa...@ges.com

 

going_green.gifPlease consider the environment before printing this e-mail

 

 

CONFIDENTIAL NOTICE: This e-mail transmission (and the attachments, if any, accompanying it) may contain confidential information. The information is intended only for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that any forwarding, disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please promptly notify the sender by reply e-mail, and then destroy all copies of the transmission.

Duane Nickull

unread,
Mar 18, 2010, 2:44:50 PM3/18/10
to Adobe LiveCycle Developers
form1.#subform[0].Button2::click - (JavaScript, client)
this.resolveNode("Height").rawValue = form1.resolveNode("Rectangle1").h;
this.resolveNode("Width").rawValue = form1.resolveNode("Rectangle1").w;


The attached PDF shows this working.

Duane



On 3/18/10 11:21 AM, "Falor, Brian" <BFa...@ges.com> wrote:

Does anyone happen to know of a JS code that will extract the width or height value of a field?  For example, if I have a field height set up for “Expand to fit” and I want to extract the actual height of that field so that I can programmatically make an adjacent field the same height, is there a way to do this?
 
_____________________________________
Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

CONFIDENTIAL NOTICE: This e-mail transmission (and the attachments, if any, accompanying it) may contain confidential information. The information is intended only for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that any forwarding, disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please promptly notify the sender by reply e-mail, and then destroy all copies of the transmission.
GetBounds.pdf

Falor, Brian

unread,
Mar 18, 2010, 2:47:34 PM3/18/10
to live...@googlegroups.com

Thanks, Duane – this is very much appreciated and will be quite useful.

 

_____________________________________

Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

GES_tag_horizontal
www.ges.com | bfa...@ges.com

 

going_green.gifPlease consider the environment before printing this e-mail

--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To post to this group, send email to live...@googlegroups.com.
To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livecycle?hl=en.

Falor, Brian

unread,
Mar 18, 2010, 3:24:51 PM3/18/10
to live...@googlegroups.com

Duane,

 

Tried it out – almost but not quite.  This code works great, but only if the first field (“Rectangle1” in this case) is not set up as “Expand to fit”.  When this checkbox is checked, it seems to return a 0 value.  I couldn’t think of any way to extract a value from this scenario as it doesn’t actually commit a value to the height or width value boxes when checked.

 

_____________________________________

Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

GES_tag_horizontal
www.ges.com | bfa...@ges.com

 

going_green.gifPlease consider the environment before printing this e-mail

 

From: live...@googlegroups.com [mailto:live...@googlegroups.com] On Behalf Of Duane Nickull
Sent: Thursday, March 18, 2010 11:45 AM
To: Adobe LiveCycle Developers
Subject: Re: field width or height

 

form1.#subform[0].Button2::click - (JavaScript, client)

--

Duane Nickull

unread,
Mar 18, 2010, 3:34:20 PM3/18/10
to Adobe LiveCycle Developers
I think you would have to intercept the H & W when the field is resized.
Until then it has no attributes for H and W (unless you set minH and MaxH
etc).

Since you are assigning the values to another object, you just have to copy
it over.

var newHeight = xfa.layout.h(TextField1, "in");
TextField2.h = newHeight + "in";

Based on the knowledge that it has resized.

This should work, no?

D


On 3/18/10 12:24 PM, "Falor, Brian" <BFa...@ges.com> wrote:

> Duane,
>
> Tried it out ­ almost but not quite. This code works great, but only if the
> first field (³Rectangle1² in this case) is not set up as ³Expand to fit².
> When this checkbox is checked, it seems to return a 0 value. I couldn¹t think
> of any way to extract a value from this scenario as it doesn¹t actually commit
> a value to the height or width value boxes when checked.
>
>
> _____________________________________
> Brian Falor | GES Intellikit Developer
>
> Main 702.515.5500 | Fax 702.515.5953
> Direct 702.515.5986 | Mobile 702.576.4958
>

> www.ges.com
> <https://www.gesdefyconvention.com/sites/default/Local%20Settings/Temporary%20
> Internet%20Files/Content.Outlook/4X2FVSU0/www.ges.com> | bfa...@ges.com


>
> Please consider the environment before printing this e-mail
>
>
> From: live...@googlegroups.com [mailto:live...@googlegroups.com] On Behalf
> Of Duane Nickull
> Sent: Thursday, March 18, 2010 11:45 AM
> To: Adobe LiveCycle Developers
> Subject: Re: field width or height
>
> form1.#subform[0].Button2::click - (JavaScript, client)
> this.resolveNode("Height").rawValue = form1.resolveNode("Rectangle1").h;
> this.resolveNode("Width").rawValue = form1.resolveNode("Rectangle1").w;
>
>
> The attached PDF shows this working.
>
> Duane
>
>
> On 3/18/10 11:21 AM, "Falor, Brian" <BFa...@ges.com> wrote:
> Does anyone happen to know of a JS code that will extract the width or height
> value of a field? For example, if I have a field height set up for ³Expand to
> fit² and I want to extract the actual height of that field so that I can
> programmatically make an adjacent field the same height, is there a way to do
> this?
>
> _____________________________________
> Brian Falor | GES Intellikit Developer
>
> Main 702.515.5500 | Fax 702.515.5953
> Direct 702.515.5986 | Mobile 702.576.4958
>

> www.ges.com
> <https://www.gesdefyconvention.com/sites/default/Local%20Settings/Temporary%20
> Internet%20Files/Content.Outlook/4X2FVSU0/www.ges.com> | bfa...@ges.com
> <mailto:bfa...@ges.com>


>
> Please consider the environment before printing this e-mail
>
>
>
>

Falor, Brian

unread,
Mar 18, 2010, 3:53:39 PM3/18/10
to live...@googlegroups.com
Yes, that seems to do the trick - thanks again

_____________________________________
Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

www.ges.com | bfa...@ges.com

Please consider the environment before printing this e-mail

This should work, no?

D

--

Falor, Brian

unread,
Mar 18, 2010, 4:16:39 PM3/18/10
to live...@googlegroups.com
Duane,

One more question to see if this is possible or not. Is there a way to assign different traits to text in the same textbox programmatically using JS. For instance if I assign a rawValue of "The dog is in the doghouse because it is snowing outside.", and I want to assign "Bold" to the portion of text "The dog" and maybe "Italic" to the portion of text "doghouse", is this possible?

_____________________________________
Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

www.ges.com | bfa...@ges.com

Please consider the environment before printing this e-mail

This should work, no?

D

--

Falor, Brian

unread,
Mar 18, 2010, 4:24:37 PM3/18/10
to live...@googlegroups.com
One more thing - the use of "layout", even though Acrobat and Reader do not show any errors associated with it and it does work ok, is causing my LC Designer Log to show "Error: Invalid property get operation; xfa doesn't have property 'layout'

_____________________________________
Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

www.ges.com | bfa...@ges.com

Please consider the environment before printing this e-mail

This should work, no?

D

--

McDivitt, David

unread,
Mar 18, 2010, 5:24:56 PM3/18/10
to live...@googlegroups.com

This is something from a PHP script I use to align column widths between tables. Maybe it will help.

 

echo "function doalign() {";

echo   "var hc = document.getElementById(\"header\").rows;";

echo   "var dc = document.getElementById(\"detail\").rows;";

echo   "if (dc.length>0) {";

echo     "hc = hc[0].cells;";

echo     "dc = dc[0].cells;";

echo     "for (var j=0;j<dc.length;j++) {";

echo       "var hw = hc[j].clientWidth;";

echo       "var dw = dc[j].clientWidth;";

echo       "if (hw>dw) {";

echo         "dc[j].style.width = hw + \"px\";";

echo         "dc[j].style.width = (hw + hw - dc[j].clientWidth) + \"px\";";

echo       "}";

echo       "else {";

echo         "hc[j].style.width = dw + \"px\";";

echo         "hc[j].style.width = (dw + dw - hc[j].clientWidth) + \"px\";";

echo       "}";

echo     "}";

echo   "}";

echo "}";

AOkamoto

unread,
Mar 19, 2010, 1:32:39 AM3/19/10
to Adobe LiveCycle Developers
Brian,
If the layout of the form will allow you to put those adjacent fields
in a table row (just turn off borders for same appearance), then the
height of the fields will be automatically adjusted. You won't need
to write script to make the changes.

I am unaware of a property that records the current height setting
when autofit is selected.
In a flowed layout, you could do the math by using the x,y coordinates
of the object in question, and the object directly below it to
determine the field size.

Angie

AOkamoto

unread,
Mar 19, 2010, 1:42:54 AM3/19/10
to Adobe LiveCycle Developers
Brian,
In regard to the following:

One more question to see if this is possible or not.  Is there a way
to assign different traits to text in the same textbox
programmatically using JS.  For instance if I assign a rawValue of
"The dog is in the doghouse because it is snowing outside.", and I
want to assign "Bold" to the portion of text "The dog" and maybe
"Italic" to the portion of text "doghouse", is this possible?

If the field is set to a Rich Text Field (as opposed to Plain Text),
then you can use xhtml codes to format the data.

To test this, and see a sample:
Add a text field, set the format to rich text, save as a PDF. Open in
Acrobat (so you can extract the xml). Turn on the properties toolbar
(Ctrl + E). When typing in the text field, select pieces and apply
formatting using the property bar.
Extract the data to examine the xhtml format in that field. Forms-
>Manage Form Data-> Extract Data.
Angie

Duane Nickull

unread,
Mar 19, 2010, 1:48:51 AM3/19/10
to live...@googlegroups.com
Angie:

We love you!!! Do you teach courses for LC Designer? Could this
group get you do do a special one hour presentation on tips and
tricks? How can we bribe you?

Duane
********
22nd Century (my band) - http://22ndcenturyofficial.com/
Twitter - @duanechaos
Blog - http://technoracle.blogspot.com
********

Angie Okamoto

unread,
Mar 19, 2010, 1:50:36 AM3/19/10
to live...@googlegroups.com
Hey Duane,
Thanks.  Yes, I teach Designer courses.  We can talk offline if you'd like.
Angie

--
Angie Okamoto

Falor, Brian

unread,
Mar 19, 2010, 10:00:35 AM3/19/10
to live...@googlegroups.com
Angie,

I'm west coast so just getting into work. This is a great concept. I'll give it a try and let you know how it comes out. Thanks for the tip!

Have a great day!

_____________________________________
Brian Falor | GES Intellikit Developer

Main 702.515.5500   |  Fax 702.515.5953
Direct 702.515.5986 |  Mobile 702.576.4958

www.ges.com | bfa...@ges.com

Please consider the environment before printing this e-mail

-----Original Message-----
From: live...@googlegroups.com [mailto:live...@googlegroups.com] On Behalf Of AOkamoto
Sent: Thursday, March 18, 2010 10:43 PM
To: Adobe LiveCycle Developers
Subject: Re: field width or height

--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To post to this group, send email to live...@googlegroups.com.
To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livecycle?hl=en.



--------------------------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages