Populating a Field via OnClick and Javascript

I am trying to populate a Field on my form via the OnClick Event. The User would click the “Action Hotspot” and this would populate a different viewable text field on the same form. The form will be used on the Web so I need to do this in Javascript. I am not sure how to do this? I know how to do this in Formula Language:@SetField(“MWPick1”; MidWestTeam1);

@Command([ViewRefreshFields])

but not in Javascript…Any help would be appreciated.

Subject: Populating a Field via OnClick and Javascript

Heres what I have…

I used the following code and it works only it is not saving the document: Any hints? Also, I chose to enable Edit Mode.

document.forms[0].MWPick1.value = document.forms[0].MidWestTeam16.value;

setTimeout ‘document.location=document.location’,1);

Subject: RE: Populating a Field via OnClick and Javascript

What’s up with the setTimeout()? It’s essentially doing the same thing as refreshing or reloading the window. You need to submit the form in order for the changes to stick.

Subject: Populating a Field via OnClick and Javascript

onclick=“document.forms[0].MWPick1.value = document.forms[0].MidWestTeam1.value”

If you are using the onClick even in Domino Designer, just enter everything between the quotation marks. (By the way, this only works in edit mode, since there are no HTML fields as such on the document in read mode.)

Subject: RE: Populating a Field via OnClick and Javascript

Maybe that is what the problem is…is there a way to render this in read mode?

Subject: RE: Populating a Field via OnClick and Javascript

While you can easily create the field(s) in passthru (hidden in edit mode), and change the displayed text, you won’t be able to change a field value directly and have it “stick” while the document is in read mode using JavaScript. A Formula Language button ought to be able to do the job – something as simple as:

FIELD FieldName1 := FieldName2;

@True

That should return the document (with a weird URL) in read mode with the field changed.