javascript elementid for To field in composer window

Talk about add-ons and extension development.
Post Reply
ElPazzo
Posts: 21
Joined: May 29th, 2005, 3:16 am
Location: Wien
Contact:

javascript elementid for To field in composer window

Post by ElPazzo »

Hi,

How can I get the value of To (CC) field in composer window when developing an addon? Or is there an extensive list of all elementids?

My searches on Google did not really return any interesting results. :(

regards,
Pascal
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: javascript elementid for To field in composer window

Post by morat »

Try these:

Code: Select all

AddRecipient("addr_to", "foo bar <test@invalid.com>");

Code: Select all

var row = 1;
var popup = awGetPopupElement(row);
var input = awGetInputElement(row);

alert(popup.label); // To:
alert(popup.value); // addr_to
alert(input.value); // foo bar <test@invalid.com>
Reference
http://dxr.mozilla.org/comm-release/sou ... ommands.js
http://dxr.mozilla.org/comm-release/sou ... Overlay.js

DOM Inspector Plus!
http://addons.thunderbird.net/thunderbird/addon/254571
http://developer.mozilla.org/docs/Tools ... _Inspector
ElPazzo
Posts: 21
Joined: May 29th, 2005, 3:16 am
Location: Wien
Contact:

Re: javascript elementid for To field in composer window

Post by ElPazzo »

Hi Morat,

Sorry, I don't get it. DOM inspector does not work on composewindow and in the reference you posted I do not really see how to get To-field or how to set/change it. You example would only be helpful if I wanted to add a new addressee.

What I want to do is get To and/or CC field and check against some domains, if true, than change address to whatever address I set as string.

regards,
Pascal
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: javascript elementid for To field in composer window

Post by morat »

DOM Inspector Plus! works in the compose window in Thunderbird 60.

Here is how to select an element in DOMi.

* 3pane window, File > New > Message ( i.e. open compose window )
* 3pane window, Tools > DOM Inspector
* DOMi window, File > Inspect Chrome Document > chrome://messenger/content/messengercompose/messengercompose.xul picture
* DOMi window, click "Find a node to inspect by clicking on it" button (top left)
* compose window, click "To:" field
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: javascript elementid for To field in composer window

Post by morat »

Are you asking for the element id for the "To:" field in the compose window in the original post?

The id for the recipient type popup element for row 1 is "addressCol1#1".
The id for the recipient input element for row 1 is "addressCol2#1".

Reference
http://dxr.mozilla.org/comm-release/sou ... Overlay.js
Post Reply