Multiline text field - scroll to the bottom

Hi,

I wonder whether it is possible to scroll to the bottom of a multiline textfield, after opening the form?
If the multiline text has much lines, the enduser has to scroll to the bottom manually now, while the most recent info is at the bottom of the text.

Is this possible with a scriptcase-macro or php-code?

thanks, regards,
Glenn

I don’t have a full working sample, but with javascript you can achieve this: [TABLE]
[TR]
[TD=“class: votecell”] [/TD]
[TD=“class: answercell”]In order to scroll to the end of the textbox, you can use:

		function buttonClicked() { var textBox = $get("Txt"); textBox.scrollTop = textBox.scrollHeight; }
		
		(you need to apply your own fieldname of course)[/TD]
	[/TR]
 [/TABLE]

Hi Albert,

thanks for the reply.
I am quite new to ScriptCase, and I’m not getting it to work correctly.

I have a single record form, after loading (or opening) I’d like to achieve that the multiline-text is positioned at the end.
I tried adding a javascriptmethod “ScrollToBottom” under Programming/Javascript methods, with the following content (“stand” is the name of my multiline textfield):

var textBox = $get(“stand”);
textBox.scrollTop = textBox.scrollHeight;

Next to that I added following code in Events/OnApplicationInit:

$javascript_function = “ScrollToBottom()”;
sc_ajax_javascript($javascript_function);

Running the application I don’t get errors, but the multiline-text is not positioned at the bottom.

Any ideas welcome!

thanks, regards,
Glenn

To be able to use ajax calls then the webclient (browser) needs to contact the server. Not the other way around and that’s why this doesn’t work. You need to inject code in the javascript section of your application menu. But it will require experimenting, it’s not something I have done very often and Javascript is not my best skill.