Print

Javascript Functions



See also...
Javascript Hints And Tips

nuImage(pImageCode)


pImageCode
The Code of the Image to display.


Returns a string that can be used in HTML image source. To display an image stored in nuBuilder's Image table (zzsys_image).

eg.

<img id='nuImg' src='formimage.php?dir=db/samplenufinancial&iid=007'>

openForm(pFormID, pRecordID)

Opens a form or report
pFormID
The primary id of the Form to open

pRecordID
The primary id of the record to edit


uDB(pElement)

Advises the database of a change in a field's value. Should be called when a field is updated by javascript.
uDB(element)

element
The form input object which has been updated (NOT the element ID).

eg uDB(document.getElementById('field_name'));

uDB(pThis,pType)

format and save to database

getRecordFromList(pRecordID, pPrefix, pNewID)


getRecordFromList__old(pRecordID, pPrefix, pNewID)


nuLoadThis()

If a function by this name is inserted into the Javascript Tab on the Form Screen, it will run when this Screen is loaded.

nuBeforeClone

If a function by this name is inserted into the Javascript Tab on the Form Screen, it will run whenever the User attempts to Clone a record on this Screen.
This function must return true or false.
It is returns true, the record will be cloned.
If it returns false the record will not be cloned and the Screen will not be refreshed.

nuBeforeSave()

If a function by this name is inserted into the Javascript Tab on the Form Screen, it will run whenever the User attempts to Save a record on this Screen.
This function must return true or false.
If it returns true, the record will be saved.
If it returns false the record will not be saved and the Screen will not be refreshed.

nuBeforeDelete()

If a function by this name is inserted into the Javascript Tab on the Form Screen, it will run whenever the User attempts to Delete a record on this Screen.
This function must return true or false.
If it returns true, the record will be deleted.
If it returns false the record will not be deleted and the Screen will return to displaying the original record, ready for editing.

nuDebug(pString)

Opens a new window and outputs the value of pString to the screen. Used for debugging. multiple debug statements from the same code section will all appear together in a single debug window.

nuFormat(pFormatNumber)


This formats numbers or dates.

(pFormatNumber = Displayed Value)
0 = 10000
1 = 10000.0
2 = 10000.00
3 = 10000.000
4 = 10000.0000
5 = 10000.00000
6 = 13-Jan-2007
7 = 13-01-2007
8 = Jan-13-2007
9 = 01-13-2007
10 = 13-Jan-07
11 = 13-01-07
12 = Jan-13-07
13 = 01-13-07
14 = 10,000
15 = 10,000.0
16 = 10,000.00
17 = 10,000.000
18 = 10,000.0000
19 = 10,000.00000
-- Euro currency formats added in version 2.7.4.4
20 = 10.000
21 = 10000,0
22 = 10000,00
23 = 10000,000
24 = 10000,0000
25 = 10000,00000
26 = 10.000
27 = 10.000,.0
28 = 10.000,00
29 = 10.000,000
30 = 10.000,0000
31 = 10.000,00000


nuFormatNumber(pValue, pDecimalPlaces, pDecimal, pSeparator)


nuFormatNumber(1234567, 5, '.', ',');

1,234,567.00000

nuNumberise(pObjectID)


nuNumberise('cus_total')


nuFormatDate(pValue, pFormat)


nuFormatDate('28-10-2009', 'dd-mmm-yyyy')
28-Oct-2009

nuFormatDate('28-10-2009', 'dd-mm-yy');
28-10-09


nuSubformRowArray(pSubformName, pJustUnticked)


Creates an array of the prefixes used for each row of the subform.

If pJustUnticked is left blank or false all rows will be added to the array.
If pJustUnticked is set to true, only those rows ticked (not to be deleted) will be added to the array.

var ar = Array();
ar     = nuSubformRowArray('FMinvoice_item');
for(var i = 0 ; i < ar.length ; i++){
   nuDebug(ar[i]);
}

will return in a separate window..

FMinvoice_item0000
FMinvoice_item0001
FMinvoice_item0002
FMinvoice_item0003
FMinvoice_item0004
FMinvoice_item0005
FMinvoice_item0006
FMinvoice_item0007


nuCreateCookie(pName,pValue,pDays)

Sets a cookie.

nuReadCookie(pName)

Gets the cookie.

nuEraseCookie(pName)

Erases the cookie.

nuGetRow()

Returns the subform row that has focus.

eg. If the row that has focus was row 2 in a subform named invoice_items, this function would return the string "invoice_items0001" (the first row being considered 0).

nuGetRowId()

Returns the Primary Key value for the Subform row with focus.

nuGetRowObjectValue(pObjectName)

Returns the Object (column) value for the Subform row with focus.

nuMask(pthis, plist)


nuJax(pURL)


nuColumnTotal(pthis, pTotalField)


nuSaveThis(pAction)


This function saves a record.

The "pAction" parameter determines what nuBuilder does after the record is saved.

  • 0 = Save and reload page (this is automatically run when enabling the "Save" Action Button)
  • 1 = Close page after save (this is automatically run when enabling the "Close" Action Button)
  • 2 = Save and reload page with a blank record (Can be added as an Extra Action Button)

noblanks()

Called automatically on save, but can be manually called elsewhere.

printIt(pCode)

This will open another window and display a Report with the same activity code as pCode.

exportIt(pCode)

This will open another window and produce a Export file with the same activity code as pCode.

runIt(pCode)

This will open another window and run PHP code with the same activity code as pCode.

runIt can take more than 1 parameter.

These parameters can be used inside a Procedure's code as a hash variable.

eg. #runIt1#, #runIt2#, #runIt3#

$sql     = "SELECT * FROM transaction WHERE transaction_id = '#runIt1#'";

pdfIt(pCode)

This will open another window and display a PDF Report with the same activity code as pCode.

emailIt(pCode,pTo,pFrom,pSubject,pMessage,pFilename,pResponse,pType)

This will email a Report with the same activity code as pCode.
pReportID cannot be left blank, this is code of the report you wish to email.
pTo is the destination email address, if left blank the user will be prompted
pFrom is the from email address, if left blank the user will be prompted
pSubject is the email subject, if left blank the user will be prompted
pMessage is the email message, if left blank the user will be prompted
pFileName is the filename of the attached report, this will be either a html file or a PDF file, if left blank the user will be prompted
pResponse, This is a boolean (NOT USED YET)
pType can be only PDF or HTML


access_level()

Returns the Access Level of the User logged in.

zzsys_user_id()

Returns the ID of the User logged in.

zzsys_user_group_name()

Returns the User Group of the User logged in.

sd()

The starting directory in which database.php resides.

SaveThis(pClose)

Saves the record.

jsDateToSqlDate(pDate)





right(pString, pLength)





openBrowse(pFormID, pFilter, pPrefix, pSession, pFormSession)


pFilter can contain hash variables.


openCalendar(pTarget, pDay, pFormat)




Created by: christopher. Last Modification: Thursday 08 of November, 2012 07:18:03 CST by steven.