When a ticket is created, I would like it to run a function (javascript) that would check three (3) dynamictext fields, and based on their combination, append data to the RichText field. If I put a javascript in a "js_on_document_complete" section - I can use simple assignment
$('#RichText').attr('value', someDefinedVariable)
I cannot get the same type of direct manipulation to work on a script called (for example) when you click the 'Create' button.
Is this possible? Or am I chasing another rainbow?
Can we append data to RichText textarea? - RESOLVED
Moderator: crythias
-
- Znuny expert
- Posts: 213
- Joined: 02 Dec 2010, 16:53
- Znuny Version: 6.0.29
- Real Name: Marc
- Company: National Jewish Health
- Location: Denver, CO
Can we append data to RichText textarea? - RESOLVED
Last edited by kruegerM on 26 Jul 2012, 15:21, edited 1 time in total.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Can we append data to RichText textarea?
You should be able to do this, although (IMO), the information you would want to have in the body is already based upon the chosen entries, so ...
Based upon what I provided ... viewtopic.php?f=60&t=8032
You said:
I said:
You could use
Based upon what I provided ... viewtopic.php?f=60&t=8032
You said:
Code: Select all
$('#RichText').attr('value', someDefinedVariable)
Code: Select all
document.compose.RichText.value = "This is line one<br/>and line 2"
Code: Select all
document.compose.RichText.value += "This is appended data line one<br/>and line 2"
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny expert
- Posts: 213
- Joined: 02 Dec 2010, 16:53
- Znuny Version: 6.0.29
- Real Name: Marc
- Company: National Jewish Health
- Location: Denver, CO
Re: Can we append data to RichText textarea?
Obviously my searching technique needs much work - thank you for the quick response! Also, I should say this is version 3.1.2. Unfortunately, I'm still not getting any added data.
I added
onclick="addMore();"
to the Create button:
<button class="Primary" id="submitRichText" accesskey="g" title="$Text{"Create"} (g)" type="submit" onclick="addMore();" value="$Text{"Create"}">$Text{"Create"}</button> -->
At the end of the file (AgentTicketPhone.dtl) I then added:
<script type='text/javascript'>
function addMore()
{
document.compose.RichText.value += "This is appended data line one<br/>and line 2"
}
</script
When I create a ticket - the only data that appears in the RichText textarea is whatever I typed in when creating the ticket. The additional data did not get appended. I put a temporary "alert" statement in the function code to verify the function is getting called - and I got my debug message, so I'm not sure where it's falling apart.
I added
onclick="addMore();"
to the Create button:
<button class="Primary" id="submitRichText" accesskey="g" title="$Text{"Create"} (g)" type="submit" onclick="addMore();" value="$Text{"Create"}">$Text{"Create"}</button> -->
At the end of the file (AgentTicketPhone.dtl) I then added:
<script type='text/javascript'>
function addMore()
{
document.compose.RichText.value += "This is appended data line one<br/>and line 2"
}
</script
When I create a ticket - the only data that appears in the RichText textarea is whatever I typed in when creating the ticket. The additional data did not get appended. I put a temporary "alert" statement in the function code to verify the function is getting called - and I got my debug message, so I'm not sure where it's falling apart.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Can we append data to RichText textarea?
I tried this:
And it did alert the proper value but didn't update the screen. I suppose that should be adequate if it works?
Edit: this is not a submit button. I only used it to test append.
Code: Select all
<input type="button" onclick="document.getElementById('RichText').value+='hello, '; alert (document.getElementById('RichText').value);">
Edit: this is not a submit button. I only used it to test append.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny expert
- Posts: 213
- Joined: 02 Dec 2010, 16:53
- Znuny Version: 6.0.29
- Real Name: Marc
- Company: National Jewish Health
- Location: Denver, CO
Re: Can we append data to RichText textarea?
I added the button as you did - and each time I selected it, it added the word "hello" to the text string, as expected.
However, when the ticket was finally created - RichText only had the original text in it - none of the appended "hello"s were there.
So I'm still confused.
However, when the ticket was finally created - RichText only had the original text in it - none of the appended "hello"s were there.
So I'm still confused.
-
- Znuny expert
- Posts: 213
- Joined: 02 Dec 2010, 16:53
- Znuny Version: 6.0.29
- Real Name: Marc
- Company: National Jewish Health
- Location: Denver, CO
Re: Can we append data to RichText textarea?
Found it. If I comment out the following line:
$Include{"RichTextEditor"}
Then the data is inserted into the field.
$Include{"RichTextEditor"}
Then the data is inserted into the field.