Elementary problem with JS

Hi.

I have a problem with JS. I want to get (or set) the values of the fields in the document.

when I use syntax like:

document.forms[0]..value

console puts an error that has no properties.

And when I use

document.forms[0].

there are no error messages on the console, but the values aren set (and when I just want to alert the value that way, it shows me “undefined”).

Please tell me, what’s the problem ?

With best regards,

Arson

Subject: Elementary problem with JS

You syntax is correct

document.forms[0].FieldName.value = ‘ok’

will set the value for FieldName.

Take in mind:

  • FieldName is case sensitive. If your fieldname in Notes is declared as FIELDNAME, you should refer to it in JS as document.forms[0].FIELDNAME.value

  • The field should be editable

  • The field should not be hidden with a hide/when formula (if it is hidden with the HTML-tag type=hidden you can refer to it in JS)

Regards,

René

Subject: RE: Elementary problem with JS

I can’t make it invisible either with div tag (and stype=“display:none”) or

any suggestions? I know it’s a easy question but i work for th first time with such things so please, be kind ;]

With best regards,

Arek

Subject: RE: Elementary problem with JS

OK, it works…

I’ll give the step-by-step solution here so other newcomers could use it as a tip:

First, I put a with just one property: display:none for the id of my div, so:

#invisible { display:none }

Then I use div to hide the content:

here you put Your things You want to be hidden

everything except the things should be marked as pass-thru HTML (text menu from the main bar).

Now I can access every field hidden that way with JS. If any filed will be hidden using “hide-when” properties, then their values won’t be sent to the browser from the server. So You won’t have access to them.

I know it’s an elementary case, but I hope it will help anyone with similar problem as I had.

With best regards,

Arek

Subject: RE: Elementary problem with JS

Hmmm…I’ll give it a try.

I have a question about that. I know that I could hide the fields with

tags with style=“display:None” and mark the text as pass-thru HTML text. but should the fields be also marked as pass-thru HTML ? because if not, they are shown on the screen

With best regards,

Arek