RECOMMENDATION: If you are using a version of The Portal Connector higher than 4.0, we strongly recommend utilizing the MVC based widgets and components to create your site. This documentation is for legacy purposes only and will soon be deprecated.

get_model()

Returns the model object that represents the model of the widget.

Example-Example -get the model and determine if configured to do XXXXX

var fn = tpc.find("firstname"); var inputMode = fn.get_model().InputMode; if(inputMode === 2){ /*.......*/ }
Parameters

Returns

Object An Object that contains the model data 

add_valueChanged()

Fired when the value of the widget is changed by the user.

The event handler function context (Available via the this keyword) will be set to the widget instance.

Example-Textfield Add Value Changed Binding

//For example, using: var a = tpc.forms[0].TpcTextfield.add_valueChanged(function(){ console.log( this.get_value()); }); //will output the selected value of the widget to the console as soon as the value changes. All delegates must be set with a variable.
Parameters

Returns

get_container()

Returns the container element of the widget.     

Example-Textfield Fetch Container Element

tpc.forms[0].TpcTextfield.get_​container();
Parameters

None

Returns

JQuery Object     

get_element()

Returns the element of the widget.

Example-Textfield Fetch Element

tpc.forms[0].TpcTextfield.get_element();
Parameters

None

Returns

JQuery Object

get_input()

Returns the input element of the widget.

Example-Textfield Fetch Input Element

tpc.forms[0].TpcTextfield.get_input();
Parameters

None

Returns

JQuery Object

get_model()

Returns the model object ​of the widget, which contains a number of useful properties related to the widget.

In the case of the CRM ​Textfield widget, these returned properties and their types are:

  • DisplayPromptChar: Boolean
  • InputMode: Integer
  • Mask: String
  • MaxValue: Integer
  • MinValue: Integer
  • NumberOfRows: Integer
  • NumericPrecision: Integer
  • PromptChar: String
  • ReadOnly: Boolean
  • ShowEditorToolBar: Boolean
  • ShowSpinners: Boolean

Example-Textfield Fetch Model

tpc.forms[0].TpcTextfield.get_model();
Parameters

None

Returns

Object

get_kendoInput()

Returns the kendo input object associated with the widget.

In the case of the CRM Textfield, only certain input modes will use a kendo input object. Otherwise, it will throw an error. These input modes are:

Numeric textfield, masked textfield, and HTML textfield.

Example-Textfield Fetch Kendo Input

tpc.forms[0].TpcTextfield.get_kendoInput();
Parameters

None

Returns

Depends on Configuration
Kendo.ui.Editor Object if set to HTML Editor
Kendo.ui.MaskedTextBox Object if Mask is set
Kendo.ui.NumericTextBox Object if Numeric attribute is used

get_value()

Returns the value of the ​widget.

Example-Textfield Fetch Value

tpc.forms[0].TpcTextfield.get_value();
Parameters

None

Returns

String if text attribute.
Integer or Decimal if Numeric attribute.

set_value()

Sets the value of the widget.

Example-Textfield Set Value

tpc.forms[0].TpcTextfield.set_value("Ivan"); //For numeric textfields... tpc.forms[0].TpcTextfield.set_value(8);
Parameters

String for all textfields
Integer or decimal for numeric textfield.

Returns

None

remove_valueChanged()

Removes any delegate hooked up to the add_valueChanged() event.

Example-Textfield Remove Value Changed Binding

//For example, using: var a = tpc.forms[0].TpcTextfield.add_valueChanged(function() { console.log( this.get_value()); }); //will output the selected value of the widget to the console as soon as the value changes. All delegates must be set with with a variable. This way you can easily remove this delegate from any widget by using: tpc.forms[0].TpcTextfield.remove_valueChanged(a);
Parameters

Function

Returns

None

hide()

Hides the widget from the form.

Example-Hide Textfield

tpc.forms[0].TpcTextfield.hide();
Parameters

None

Returns

None

show()

Shows the widget on the form.

Example-Show Textfield

tpc.forms[0].TpcTextfield.show();
Parameters

None

Returns

None

enable()

enable the widget 

Example-EXAMPLE-ENABLE TEXTFIELD

tpc.forms[0].TpcTextfield.enable();
Parameters

None

Returns

None

toggle()

toggles the visibility of the widget. ​

Example-EXAMPLE-TEXTFIELD TOGGLE

tpc.forms[0].TpcTextfield.toggle()
Parameters

None

Returns

None

readonly()

 set the widget state to read only

Example-EXAMPLE- TEXTFIELD- READONLY

//set to true
tpc.forms[0].TpcTextfield.readonly(true);

//set to false
tpc.forms[0].TpcTextfield.​readonly(false);

//show the read only status
tpc.forms[0].TpcTextfield.​readonly();
Parameters

true, false

Returns

None

disable()

disable the widget

Example-EXAMPLE-DISABLE TEXTFIELD

tpc.forms[0].TpcTextfield.​disable()
Parameters

None

Returns

None