top of page

Moji5 Knowledgebase

How to use AJAX

Updated: Dec 1, 2021

In this tutorial, we will discover 5 topic which are:

- AJAXCascadingDropdown

- AJAXDisplayValue

- AJAXDisplayHTML

- AJAXHideUnhide

- HideUnhide


1) How to use AJAXCascadingDropdown


Create a dropdown. Name it as Master.


Below is the setting for Master dropdown. This Master dropdown will populate data from alan_master table.




















Create another a dropdown. Name it as detail.


Leave it as default setting as per below image.










Click Advanced settings on Master dropdown.


Click New attribute.

Add below javascript code. Click Save changes.


Go to your application home. Click Edit.


Click AJAX Libraries.

Click “Create a new AJAX Library”.

Insert the AJAX name and click the view code.

Write your code here, you can refer to notes for reference. Click Check Syntax, if no error then click Save and close.


Example the code:

dim strSQL as string="SELECT [detail] AS Caption,id AS Value from QF_alan_detail WHERE [master]='[$1]'" 
dim dsData as dataset =scribe.RunDynamicSQLReturn(strSQL)

return scribe.RunDatasetReturnJSON(dsData)

Now you have done the AJAX, let try select the Master field and it will display the respective detail info.



2) How to use AJAXDisplayValue


Create a dropdown. Name it as Master.


Below is the setting for Master dropdown. This Master dropdown will populate data from alan_master table.




















Create a field. Name it as detail.


Click Advanced settings on Master dropdown.


Click New attribute.


Add below javascript code. Click Save changes.


Go to your application home. Click Edit.


Click AJAX Libraries.


Click “Create a new AJAX Library”.


Insert the AJAX name and click the view code.


Write your code here. Click Check Syntax, if no error then click Save and close.


Example the code:

dim strSQL as string="SELECT id AS Value from QF_alan_master WHERE [Master]='[$1]'" 
dim dsData as dataset =scribe.RunDynamicSQLReturn(strSQL)

Dim tempID as string = ""
if dsData is nothing=false then
        if dsData.Tables(0).Rows.Count>0 then
            Dim _rowSC_GUID as datarow = dsData.Tables(0).Rows(0)
            tempID = scribe.GetText(_rowSC_GUID("Value"))
        end if
end if

Return tempID

Click Create now.


Now you have done the AJAXDisplayValue, let try select the Master field and it will display the respective detail info.



3) How to use AJAXDisplayHTML


Create a dropdown. Name it as Master.


Below is the setting for Master dropdown. This Master dropdown will populate data from alan_master table.




















Create a label. Name it as detail.


Click Advanced settings on Master dropdown.


Click New attribute.


Add below javascript code. Click Save changes.


Go to your application home. Click Edit.


Click AJAX Libraries.


Click “Create a new AJAX Library”.


Insert the AJAX name and click the Define by code.


Write your code here. Click Check Syntax, if no error then click Save and close.

Example the code:

dim strSQL as string="SELECT masterdescription AS Caption from QF_alan_master WHERE [Master]='[$1]'" 
dim dsData as dataset =scribe.RunDynamicSQLReturn(strSQL)
Console.Write(strSQL)
Dim desc as string = ""
if dsData is nothing=false then
        if dsData.Tables(0).Rows.Count>0 then
            Dim _rowSC_GUID as datarow = dsData.Tables(0).Rows(0)
            desc = scribe.GetText(_rowSC_GUID("Caption"))
        end if
end if

Return desc

Click Create now.


Now you have done the AJAXDisplayHTML. Let try select the Master field and it will display the respective detail info.



bottom of page