All,I have reviewed the forums, and cannot see to find what I am looking for. I am weak in javascript skills, and am in search of an answer to this issue.
I have a multi-value, text field used for a document history field. I have a javascript routine that processes revisions in the approval area of the document, but I need to add an entry to the document history field when the user clicks the revise button. How in javascript do I append a line of text to what is already in the field without over-writing what is already there?
Thanks for your knowledge
David
Subject: Append text to field using javascript
document.forms[0].FieldName.value += “\n” + “Your new string here”;
Subject: RE: Append text to field using javascript
Thanks Stan!
One slight issue though. It is not putting the entry on a new line. Actually, what I am having to do, since I do not want the history field editable is to put the editable field on the form, along with a computed value area, with the code pointing to the field, and lump all this around div tags, otherwise the JS was not able to write to it, because it is computed.
Any way to get the code you sent to go on new lines (I see the \n), but it is just running it all together one after the other.
Example:
04/09/2008 03:25:26 PM - ULD Initiated By Test User4/9/2008 15:26:13 Returnable Reassign Requested by Test User: Reassign Comments Here4/9/2008 3:27:47 PM Returnable Approved by Test User4/9/2008 15:32:58 Returnable Revision Requested by Test User: Revision Comments Here
Thanks
David
Subject: RE: Append text to field using javascript
Did you know that putting “readonly” in the HTML attributes for the field makes it writable using JavaScript, submittable to Domino, but prevents direct editing by the user?
Currently, you are using a field that is marked as type=“hidden”, which means that the new line probably won’t be recognised by Domino as a value separator. Using a semicolon instead should do the trick, but you’d need to put a
between entries in your computed display area (or wrap each entry in
tags). Field widgets in the browser use literal whitespace (spaces, new lines and so forth), but regular HTML ignores tabs, multiple spaces and newlines.
Subject: RE: Append text to field using javascript
Stan,I took your advise and made the ULDHistory field type=Readonly, and I am still getting the error:
opener.documents.forms.0.ULDHistory is null or not an object
Thoughts?
David
Subject: RE: Append text to field using javascript
I figured it out. Syntax error!
readonly = true
NOT
type = readonly
Subject: RE: Append text to field using javascript
This might work, but in fact, readonly is an empty attribute in HTML, so you should just add readonly, and not set it to any value.
If you need to write xhtml, it should be readonly=“readonly”.