Hello,
I have two more things, that I have to implement into my chat. I have tried so many things and it doesn't work ... perhaps somebody could help me again:
1. I have a text area with a vertical scroll bar. Every time somebody enter a text into another text, the text will be copied to the end of the text area. This works fine. Now I want to scroll down in the text area, so that the user can see the entered text.
I have done the following:
In Html Elemet properties of the send button in the chat , I defined an ID "CHAT_SEND_BUTTON" and the Event "on_click" will be set to "chat_scroll_down(this)".
Now I develop a client script looks like this:
--------------------------------------------
$(document).ready(function(){
});
chat_scroll_down = function(element)
{
element.scrollTop = element.scrollHeight;
}
--------------------------------------------
Nothing happens. This function is also added to the web ressources in the form properties.
2. I want to add a timer control, so that from time to time, the text area
will be refreshed. I use nearly th following code:
------------------------------------------
$(document).ready(function()
{
});
window.setInterval(function() {
var elem = document.getElementById('CHAT_SEND_BUTTON');
elem.scrollTop = elem.scrollHeight;
}, 5000);
------------------------------------------
I have added both to the page and when I view the source, I can't see the code.
What do I wrong ...
Thank you very much
Manfred
Scrolling down and timer event
Moderators: Jon, Steve, Ian, Dave
-
Steve
- Moderator

- Posts: 423
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
Hi Manfred,
I think your timer function looks fine.
If you have added the client script to your form, then you will only see a reference to the client script in the source e.g:
You could try putting an alert in there and check that this is being called:
Sometimes alerts can help you debug these things. Or the other option maybe the firebug plugin for firefox.
For the scroll, could you create a JQuery event for key down on your text area and check for enter key and then scroll to bottom?
Steve
I think your timer function looks fine.
If you have added the client script to your form, then you will only see a reference to the client script in the source e.g:
Code: Select all
<script src="clientScripts?clientScriptId=MY_CLIENT_SCRIPT&ebz=1_1363611968484" type="text/javascript"></script>Code: Select all
window.setInterval(function() {
alert('Timer called');
var elem = document.getElementById('CHAT_SEND_BUTTON');
elem.scrollTop = elem.scrollHeight;
}, 5000);
For the scroll, could you create a JQuery event for key down on your text area and check for enter key and then scroll to bottom?
Steve
0 x
-
Pnirff
- Ebase User
- Posts: 21
- Joined: Fri Jan 25, 2013 8:36 am
-
Steve
- Moderator

- Posts: 423
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
That is strange. I just tested this to make sure this was working.
I just tried adding a client script to a new form. The client script has:
Then I ran the form and the alert was printed out.
Are you 100% sure that the client script is listed in the Web Resources part of the the form and the apply is ticked?
Steve
I just tried adding a client script to a new form. The client script has:
Code: Select all
alert('Hello');
Are you 100% sure that the client script is listed in the Web Resources part of the the form and the apply is ticked?
Steve
0 x
-
Pnirff
- Ebase User
- Posts: 21
- Joined: Fri Jan 25, 2013 8:36 am
Hello,
yes. I am 100% sure, but when I remove the lines:
$(document).ready(function()
{
});
so that the script look like :
window.setInterval(function() {
var elem = document.getElementById('CHAT_SEND_BUTTON');
elem.scrollTop = elem.scrollHeight;
}, 5000);
it works fantastic ... I am not 100% familiar with javascript. Sorry for that.
But thx anyway
Manfred
yes. I am 100% sure, but when I remove the lines:
$(document).ready(function()
{
});
so that the script look like :
window.setInterval(function() {
var elem = document.getElementById('CHAT_SEND_BUTTON');
elem.scrollTop = elem.scrollHeight;
}, 5000);
it works fantastic ... I am not 100% familiar with javascript. Sorry for that.
But thx anyway
Manfred
0 x
Who is online
Users browsing this forum: Bing [Bot] and 40 guests