Need help with Javascript and HTML fields in the client :-(

I have a short script on a form, it creates three HTML fields when the form is opened in the Notes client, using names stored in a multivalue notes field. This appears to work, at least on the surface. It also assigns a value to each field from a second multivalue field. Then I have a loop that reads back the values and prints an alert for each field. At this point I get an error - ToObjectError - document.forms[0].value has no properties. Can anyone help with this? I’m not very good at JS yet, I found sometimes I can read in one of the three fields (usually the second one), but never all three.

Any help would be appreciated! Thanks

Steve

Subject: Need help with Javascript and HTML fields in the client :frowning:

It just ain’t going to work in the client. The client (AFAIK) doe not know from forms[0]/HTML fields. The code you are using will not work in the client (oh and I wish it did because there are so many UI things I would like to be able to do in the client with DHTML and JavaScript but cannot).

Subject: Need help with Javascript and HTML fields in the client :frowning:

That’s right: document.forms[0] has no properties, because document.forms[0] is not an array. If the field name needs to be dynamic, then use:

document.forms[0].elements.value

Subject: RE: Need help with Javascript and HTML fields in the client :frowning:

Hmmm… still can’t read them. If I put in alert(document.forms[0].Name1.value); it reads that, but if I substitute any of the values that were supposedly created earlier in the script, I get an error that it has no properties…OK - alert(document.forms[0].Name1.value);

Not OK - alert(document.forms[0].D6E5100574E59.value);

I’m pretty sure I’m creating the field with this name correctly. I tried hard coding the name to create it, and got the same result:

document.write(‘<INPUT TYPE=TEXT NAME=D6E5100574E59 MAXLENGTH=1 SIZE=2’); alert(document.forms[0].D6E5100574E59.value);

does not work.

It would seem to me that if you can create fields and put values in them, there must be a way to read them, unless it’s just Notes being annoying :slight_smile:

Subject: RE: Need help with Javascript and HTML fields in the client :frowning:

Sorry – I should have read more closely. Notes client, eh? The document object “forms[0]” is the Designer form in the Notes client. The document is not mutable – you can create all kinds of stuff for display in passthru, but the form object consists only of Designer fields.

Subject: RE: Need help with Javascript and HTML fields in the client :frowning:

They just don’t want to make our lives easier I guess. It looks like I’m headed for rewriting the whole darned thing for the web :P~ Stinks. I guess I could stick a whole whack of fields and hope they don’t use more than what’s there…

Subject: RE: Need help with Javascript and HTML fields in the client :frowning:

It has nothing to do with making your life easier or not. That is not the responsibility of IBM or anyone else.

There is a way you can “cheat”, its called

notesdocument.appenditemvalue, which creates an item if it does not exist. It does not appear as a field, but it is stored in the document and if you set isSummary to true, you can use it in view columns.

Subject: Need help with Javascript and HTML fields in the client :frowning:

Can you give us the values of the two fields called Name1 and Values1 ?

It will help to figure out what to problem is !

Renaud

Subject: RE: Need help with Javascript and HTML fields in the client :frowning:

Sorry about that, the values in the Name1 field are actually the computed result of a dbcolumn to documents in a view, the names are part of the DocID of the documents that it finds there (so in effect if a user adds a document, a new field will appear on the form, kinda cool). So the Name1 field would be something like “DF63D33F3285,DF63D33F324A,DF63D33F3293” and the Values1 field is just an editable field that I stored “1,2,4” in on the form. I’m wondering if it is not possible to access HTML fields using the document.forms[0] format? Hmmm… I need to create these fields on the fly though, and I don’t know of another way, it can’t be a multivalue field.Steve

Subject: Need help with Javascript and HTML fields in the client :frowning:

Maybe you’re using the wrong tool, and JS isn’t the answer.

What is it that you are trying to accomplish? It probably can be done some other way such as computed-for-display fields.

Tell us what you need to have happen.