Difference between revisions of "JavaScript functions v1.0"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
old>Admin
Line 1: Line 1:


== Builtin functions ==
= Builtin functions =


=== Handling form values ===
== Handling form values ==
Display values are handled using standard getter and setters
Display values are handled using standard getter and setters
* '''getValue(fieldName) '''
* '''getValue(fieldName) '''
Line 19: Line 19:
   var recordId = getDecimal("SELECTRECORD");
   var recordId = getDecimal("SELECTRECORD");


=== Toggling fields (version 5478+) ===
== Toggling fields (version 5478+) ==
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.


Line 33: Line 33:




==== Dependent toggling ====
=== Dependent toggling ===


Hiding and showing fields can be made dependent on classes in the TempusServaPage
Hiding and showing fields can be made dependent on classes in the TempusServaPage
Line 47: Line 47:
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''


==== Disclaimer ====
=== Disclaimer ===
The functions are the equivilant of JQuery  
The functions are the equivilant of JQuery  



Revision as of 15:41, 6 January 2021

Builtin functions

Handling form values

Display values are handled using standard getter and setters

  • getValue(fieldName)
  • setValue(fieldName,value)

Example

  var a = getValue("NUMBER1");
  var b = getValue("NUMBER2");
  setValue( "RESULT", (a-b) );

For explicitly getting a value (or ID) use

  • getDecimal(fieldName)

Example

 var recordId = getDecimal("SELECTRECORD");

Toggling fields (version 5478+)

Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.

Fields can be shown or hidden calling the fieldname

  • hideField(fieldName)
  • showField(fieldName)

Examples

  hideField("USER")
  hideField("StatusID")


Dependent toggling

Hiding and showing fields can be made dependent on classes in the TempusServaPage

  • hideFieldForPageClass(fieldName,className)
  • showFieldForPageClass(fieldName,className)

Hiding and showing fields can be made dependent on items current status.

  • hideFieldForStatusId(fieldName,statusId)
  • showFieldForStatusId(fieldName,statusId)

Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.

  • hideFieldForPageClassAndStatusId(fieldName,className,statusId)
  • showFieldForPageClassAndStatusId(fieldName,className,statusId)

Disclaimer

The functions are the equivilant of JQuery

  $("#VB_DATA_"+fieldName).parent().parent().hide();
  $("#VB_DATA_"+fieldName).parent().parent().hide();

This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work

Other sources