Home
TeamSite
Accessing template fields via javascript
skbaker
I am running TeamSite 5.5.2 on AIX.
I have working javascript that I want to run against the fields on my template. However, I am having trouble getting a handle on the html "form" in the template, so that I can then access that form's elements.
The end result I'm looking for is fairly complicated, but I can boil it down to a simple example, and if someone can tell me how to do this example, I can use the same logic to do what I need.
The simple example is... show me how to display the value of a text field in an alert box without using any of the FormAPI commands (such as getValue())
Typically this would be done with something like this:
alert (document.forms['myform'].element['myelement'].value);
For the "myelement" part, I know the TeamSite-generated "name" of the element I want because I can see it when I view the source html for the form.
As for the "myform" part, the source html shows that the only form in the frame is "dcreditForm", but when I plug those values in, I get undefined results. I then tried to display the number of forms present on the frame with this:
alert (document.forms.length);
but the result of that is zero, although I would expect it to be one (for dcreditForm). I don't understand why that form is inaccessible.
I tried chasing down the parent and sibling frames and determined that the frame that contains the input fields is called "formframe", so I tried approaching it from the topmost level with something like this:
alert (top._dcWin.frames["formframe"].document.forms.length);
but that gives me a result of zero as well.
There's got to be something I am missing here in terms of frames, parents, forms, or something. Or maybe the "onload" in formframe's body tag is throwing it all off.
Can somebody help me with the syntax required to access these fields?
Also, if anyone is interested in what my real goal is here (remember, the display of the value was just an example), I'll be glad to post more information.
Find more posts tagged with
Component react.asset.postCommentThread had an error.
type is required.