I’ve got a from showing a list of messages . I want the user to able to click on a REPLY button on one of these records and show a new message in a Form in Dialogue. This should allows the user to create a new message with the details of the message the user is responding to appended to the new message (RE:).
I’ve got the following code that’s not working,
I can’t see where I am going wrong.
var MessageBody = messagebody;
var MessageHeader = messageheader;
Many thanks. It’s a big improvement and nearly working but not quite. For some reason, which I can’t figure, the "RE’ is not being put into the Message Header or MessageBody.
Sorry, I didn’t spot this earlier - try changing your variable names as they are same as Field Names. Suggest vMessageHeader and vMessageBody for the local variables.
This also makes it easier to understand when looking at the code months later
Sound advice, many thanks. Still having a problem though getting the
‘RE’ + vMessageHeader to work and the same with ‘RE’ + vMesageBody. The RE is not being added in along with the local variable.
Are the fields: messageheader & messagebody display types set as text fields or are they RFT or HTML fields ?
If they are RTF then the data will not be appended as these fields contain hidden tags which format the display text and the appended text falls before these tags and thus remains invisible !
The method I use for these fields is the following:
// Insert the 'RE:' part in messageheader
elements.nameOfMessageheaderField.caretPosition = 0; // Set cursor position to the beginning of the field
elements.nameOfMessageheaderField.replaceSelectedText('RE:');
// Insert the 'RE:' part in messagebody
elements.nameOfMessagebodyField.caretPosition = 0; // Set cursor position to the beginning of the field
elements.nameOfMessagebodyField.replaceSelectedText('RE:');
Of course you need to name the fields on the form.
Just a combination of a couple of threads over the past week or so which spoke about the vagaries of dealing with these field types plus a ‘Gotcha’ entry on Servoy Magazine by David Workman