Html Area

(part of package 'Servoy Extra Components') Extends designtime/SolutionModel: JSWebComponent Extends runtime: RuntimeWebComponent

This is a reference page; many components have detailed usage guides here.

Properties

dataProviderID

Type: Dataprovider


displaysTags

Type: Boolean


editable

Type: Protected Default Value: true


enabled

Type: Enabled Default Value: true


placeholderText

Type: String


readOnly

Type: ReadOnly


responsiveHeight

Min height of the html editor, set only in responsive forms.

Type: Number Default Value: 300


scrollbars

Type: Scrollbars


styleClass

Type: Styleclass


tabSeq

Type: Tabseq


text

Type: String


toolTipText

Type: String


visible

Type: Visible


Events

onActionMethodID(event)

Parameters:


onDataChangeMethodID(oldValue,newValue,event)

@return {boolean}

Parameters:

Returns: {Boolean}


onFocusGainedMethodID(event)

Parameters:


onFocusLostMethodID(event)

Parameters:


onRightClickMethodID(event)

Parameters:


API

getAsPlainText()

Gets the plain text for the formatted Html Area.

Example:

var my_text = myElement.getAsPlainText();

Returns: String The plain text


getScrollX()

Returns the x scroll location of specified element - only for an element where height of element is less than the height of element content. NOTE: getScrollX() can be used with getScrollY() to set the scroll location of an element using the setScroll function.

For Example:

//returns the X and Y scroll coordinates
var x = forms.company.elements.myarea.getScrollX();
var y = forms.company.elements.myarea.getScrollY(); 
//sets the new scroll location
forms.company.elements.myarea.setScroll(x+10,y+10);

Example:

var x = myElement.getScrollX();

Returns: Number The x scroll location in pixels.


getScrollY()

Returns the y scroll location of specified element - only for an element where height of element is less than the height of element content. NOTE: getScrollY() can be used with getScrollX() to set the scroll location of an element using the setScroll function.

For Example:

//returns the X and Y scroll coordinates
var x = forms.company.elements.myarea.getScrollX();
var y = forms.company.elements.myarea.getScrollY();
//sets the new scroll location
forms.company.elements.myarea.setScroll(x+10,y+10);

Example:

var y = myElement.getScrollY();

Returns: Number The y scroll location in pixels.


getSelectedText()

Returns the currently selected text in the specified Html Area.

Example:

var my_text = myElement.getSelectedText();

Returns: String The selected text in the Html Area.


replaceSelectedText(selectedText)

Replaces the selected text; if no text has been selected, the replaced value will be inserted at the last cursor position.

Example:

myElement.replaceSelectedText('John');

Parameters:

  • {String} selectedText The replacement text

Returns: String The new content after replace.


requestFocus(mustExecuteOnFocusGainedMethod)

Set the focus to this Html Area.

Example:

myElement.requestFocus();

Parameters:

  • {Boolean} [mustExecuteOnFocusGainedMethod] If false will not execute the onFocusGained method; the default value is true


selectAll()

Selects all the contents of the Html Area.

Example:

myElement.selectAll();

setScroll(x,y)

Sets the scroll location of an element. It takes as input the X (horizontal) and Y (vertical) coordinates - starting from the TOP LEFT side of the screen - only for an element where the height of the element is greater than the height of element content NOTE: getScrollX() can be used with getScrollY() to return the current scroll location of an element; then use the X and Y coordinates with the setScroll function to set a new scroll location.

For Example:

//returns the X and Y coordinates
var x = forms.company.elements.myarea.getScrollX();
var y = forms.company.elements.myarea.getScrollY();
//sets the new location
forms.company.elements.myarea.setScroll(x+10,y+10);

Example:

myElement.setScroll(200,200);

Parameters:

  • {Number} x The X coordinate of the htmlarea scroll location in pixels

  • {Number} y The Y coordinate of the htmlarea scroll location in pixels



Last updated

Was this helpful?