afterDialogValidate

Description

Fires after the UX Component is successfully validated. Does not fire if the dialogValidate event returns an error.

e.dataSubmitted

Contains all values that were submitted by the component.

e.oldDataSubmitted

Contains the original values in the controls.

e.listInfoJSON

If the UX Component contains a List with a check-box select control, contains a array of objects in JSON format of the checked rows for each List in the UX. The array has the following format:

{"list":"listId","checkedRows":"comma_delimited_list_of_checked_rows"}

"list" contains the ID of the List control. If the List has a check-box select column, "checkedRows" is a comma delimieted list of rows that have been checked.

You can inspect the JSON to determine what rows are checked in a List with a check-box select control. For example:

DIM listInfo AS P
listInfo = json_parse(e.listInfoJSON)

if (listInfo.size() > 0) then
    if (variable_exists("listInfo[1].checkedRows")) then
        DIM listId AS C
        DIM rows AS C
        listId = listInfo[1].list
        rows = crlf_to_comma(listInfo[1].checkedRows.dump_properties(" value"))
        ' Return JS alert displaying the list of checked rows for the first list in listInfo.
        e.javascript = "alert('Checked rows for list \'"+listId+"\' : "+rows+"');"
    end if
end if

If a list has no checked rows, the checkedRows property will be blank.

All values in e.dataSubmitted and e.oldDataSubmitted are character type. Use the convert_type() function to convert data to a different type.

The list of dirty submitted fields is in: e.dirtyColumns. This is a CRLF delimited string of dirty fields (i.e. fields edited by the user). For example:

FIRSTNAME
QTY_A5INSTANCE3

Important 

If your event handler modifies a value in the e.dataSubmitted object (and that field has NOT been edited by the user), you MUST explicitly add the field to the e.dirtyColumns value yourself.

For example, assume that you want to set the Company field to 'Alpha' and the 'Qty' field in row 1 of a repeating section regardless of whether the user edited the value or not:

e.dataSubmitted.COMPANY = "alpha"
e.dataSubmitted.QTY_A5INSTANCE2 = "2"
e.dirtyColumns = e.dirtyColumns + crlf()+ "COMPANY" + crlf() + "QTY_A5INSTANCE2"

Repeating Sections 

If your dialog contains repeating sections, data in the repeating sections will be in an array. For example, say that your dialog has a repeating section that includes a field called QTY:

e.dataSubmitted.qty[1]

Contains data from first repeating section row

e.dataSubmitted.qty[2]

Contains data from second repeating section row, etc

e.dataSubmitted.favoriteColors[2][3]

Contains data from the second row - 'favoriteColors' is a multi-select control - returns the 3rd choice the user made

e.dataSubmitted.qty.size()

Number of entries in the array.

In addition, the e object will contain information about the repeating sections

e.repeatingSectionNames

A comma delimited list of the name (container ID) or each repeating section

e.repeatingSectionInfo

A property array with one entry for each repeating section.

The e.repeatingSectionInfo[] array will have these properties for each entry:

.activeRow

The row in the repeating section that had focus when the Dialog was submitted

.deletedRows

A CRLF delimited list of rows that were deleted. e.g. 1 and 3

.rowCount

A count of the number of non-deleted rows

.totalRowCount

A count of all rows in the repeating section including rows that were deleted

.fieldsInRepeating section

A CRLF delimited list of fields in the repeating section

.dirtyRowsInSection

A CRLF delimited list of rows in the repeating section that were edited. (A row that was edited, then deleted will still appear in this list).

.dirtyFieldsInSection

A CRLF delimited list of fields in the repeating section that were edited. for example: PARTNO_A5INSTANCE3 is the 'PARTNO' field in row 3.

Request 

The Request object. Includes Request.Variables, which should be used instead of the older e.rv construct

Session 

The Session object. Should be used instead of the older e.session construct

Also inside e: 

e.tmpl

Component definition

e.rtc

Runtime calculations, you can use this to store data to be passed to other server side events (Note: the 'rtc' object cannot be used to persist state information - i.e. you can't set a value in rtc and then read that value in a subsequent callback. To persist state info see e._state).

e.arguments

SQL::Arguments object with values for each of the arguments defined in this component. To read a value from arguments: e.arguments.find("argumentName").data

You can can set these properties:

e.url

if you want to redirect to another page, set this property

e.javascript

if you want to send some javascript back to the browser, set this property.

TIP: If you want to set the form back to a 'clean' state (which will cause the Submit/Reset buttons to go back to disabled) you should send the following Javascript back to the browser:

e.javascript = "{dialog.object}.resetForm(false); //false suppresses the confirmation mesage"

You can set 'state' variables in this event. The value of any state variables will be available in all subsequent ajax callbacks. To set a state variable:

e._state.myvar1 = "value1"
e._state.myvar2 = "value2"

To read the value of a 'state' variable that was previously set:

e._state.myvar1

Closing the Window in Which the UX Component is Hosted 

In certain cases the UX component will have been opened in a pop-up Ajax window and you will want code in this event handler to close the pop-up window. Here is how you can do this:

  • a) In the action that opens the UX in a window, set the Window title to something like this: MyWindowTitle

  • b) In this event handler set e.javascript to:

    var ele = $('mywindowid');
    {dialog.object}.closeContainerWindow(ele);

If you have used Server-side Action Scripting in this event to save the submitted data to a table, then you might want to reference the rtc.flagRecordWasSaved variable (which is set by the Action Script) to decide if the window should be closed or not. In addition, since the Server-side Action will have already set the value of the e.javascript variable, you will want to append your code to e.javascript, as follows:

e.javascript = e.javascript + crlf() + var ele = $('mywindowid'); + crlf() + {dialog.object}.closeContainerWindow(ele);

See Also