B4J Question [ABMaterial] ABMRadioGroup and Click Event [Solved]


Well-Known Member
Licensed User
Longtime User
In one of my page I have ABMRadioGroup. I am unable to capture the click event. I do not understand why the click event is not fired. I have used ABMRadioGroup in another page and is working fine. I am going nuts why this is not working on this particular page.

Here is the code of the page. There is nothing other than the RadioGroup in this particular page.
'Class module
Sub Class_Globals
    Private ws As WebSocket 'ignore
    ' will hold our page information
    Public page As ABMPage
    ' page theme
    Private theme As ABMTheme
    ' to access the constants
    Private ABM As ABMaterial 'ignore   
    ' name of the page, must be the same as the class name (case sensitive!)
    Public Name As String = "TargetService"  '<-------------------------------------------------------- IMPORTANT
    ' will hold the unique browsers window id
    Private ABMPageId As String = ""
    ' your own variables
    Private nUserID,cApptype As String
    Private myToastId As Int = 1
    Private nTargetType As Int = 0
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
    ' build the local structure IMPORTANT!
End Sub

#Region ABM
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)   
    ws = WebSocket1       
    ABMPageId = ABM.GetPageID(page, Name,ws)
    Dim session As HttpSession = ABM.GetSession(ws, ABMShared.SessionMaxInactiveIntervalSeconds)
    If session.IsNew Then
        ABMShared.NavigateToPage(ws, "", "./")
    End If
    If ABMShared.NeedsAuthorization Then
        If session.GetAttribute2("IsAuthorized", "") = "" Then
            ABMShared.NavigateToPage(ws, ABMPageId, "../")
        End If
    End If       
    ABM.UpdateFromCache(Me, ABMShared.CachedPages, ABMPageId, ws)       
    If page.ComesFromPageCache Then
        ' when we have a page that is cached it doesn't matter if it comes or not from a new connection we serve the cached version.
        Log("Comes from cache")       
        If page.WebsocketReconnected Then
            Log("Websocket reconnected")
            ' when we have a client that doesn't have the page in cache and it's websocket reconnected and also it's session is new - basically when the client had internet problems and it's session (and also cache) expired before he reconnected so the user has content in the browser but we don't have any on the server. So we need to reload the page.
            ' when a client that doesn't have the page in cache and it's websocket reconnected but it's session is not new - when the client had internet problems and when he reconnected it's session was valid but he had no cache for this page we need to reload the page as the user browser has content, reconnected but we have no content in cache
            ABMShared.NavigateToPage (ws, ABMPageId, "./" & page.PageHTMLName)
            ' when the client did not reconnected it doesn't matter if the session was new or not because this is the websockets first connection so no dynamic content in the browser ... we are going to serve the dynamic content...
            Log("Websocket first connection")
        End If
    End If
End Sub

Private Sub WebSocket_Disconnected
End Sub

Sub Page_ParseEvent(Params As Map)
    Dim eventName As String = Params.Get("eventname")
    Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))
    If eventName = "beforeunload" Then
        Log("preparing for url refresh")
        ABM.RemoveMeFromCache(ABMShared.CachedPages, ABMPageId)
    End If
    Dim caller As Object = page.GetEventHandler(Me, eventName)
    If caller = Me Then
        If SubExists(Me, eventName) Then
            If eventName = "page_dropped" Then
            End If
            Select Case Params.Size
                Case 0
                    CallSub(Me, eventName)
                Case 1
                    CallSub2(Me, eventName, Params.Get(eventParams(0)))
                Case 2
                    If Params.get(eventParams(0)) = "abmistable" Then
                        Dim PassedTables As List = ABM.ProcessTablesFromTargetName(Params.get(eventParams(1)))
                        CallSub2(Me, eventName, PassedTables)
                        CallSub3(Me, eventName, Params.Get(eventParams(0)), Params.Get(eventParams(1)))
                    End If
                Case Else
                    ' cannot be called directly, to many param
                    CallSub2(Me, eventName, Params)
            End Select
        End If
        CallSubDelayed2(caller, "ParseEvent", Params) 'ignore
    End If
End Sub

public Sub BuildTheme()
    ' start with the base theme defined in ABMShared

    ' add your specific page themes
    ' the page theme
    theme.Page.BackColor = ABM.COLOR_GREY
    theme.Page.BackColorIntensity =  ABM.INTENSITY_LIGHTEN3
End Sub

public Sub BuildPage()
    ' initialize the theme
    ' initialize this page using our theme
    page.InitializeWithTheme(Name, "/ws/" & ABMShared.AppName & "/" & Name, False, ABMShared.SessionMaxInactiveIntervalSeconds, theme)
    page.PageHTMLName = "index.html"
    page.PageTitle = "Target vs Achievements (Service)"
    page.PageDescription = "Target vs Achievements (Service)"
    page.PageKeywords = ""
    page.PageSiteMapPriority = ""
    page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
    page.ShowConnectedIndicator = True
    ' adding a navigation bar
    ABMShared.BuildNavigationBar(page, "Target vs Achv (Service)","../images/logosmall.jpg", "", "", "")
    ' create the page grid
    page.AddRowsM(2,True,20,0, "").AddCells12MP(1,0,0,0,0,"")
    page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components       
End Sub

public Sub ConnectPage()           
    '    connecting the navigation bar
    ' ABMShared.ConnectNavigationBar(page)

    Dim RadioTrgtType As ABMRadioGroup
    RadioTrgtType.AddRadioButtonNoLineBreak("Volume", True)
    RadioTrgtType.AddRadioButtonNoLineBreak("Income", True)

    ' refresh the page
    ' Tell the browser we finished loading
    ' restoring the navigation bar position
End Sub
#end region

'The following sub is not raised
Sub RadioTrgtType_Clicked(Target As String)
    Dim RadioTargetType As ABMRadioGroup = page.Component("RadioTrgtType")
    nTargetType = RadioTargetType.GetActive()
    Log("Target is " & Target)
    page.ShowToast("toast" & myToastId, "toastorange", "Clicked on "& nTargetType, 5000, False)

End Sub

#Region ABMPage
' clicked on the navigation bar
Sub Page_NavigationbarClicked(Action As String, Value As String)
    ' saving the navigation bar position
    If Action = "LogOff" Then
    End If

    ABMShared.NavigateToPage(ws, ABMPageId, Value)
End Sub

Sub Page_DebugConsole(message As String)
    Log("---> " & message)
End Sub

#end region

Any help will be appreciated


Licensed User
Longtime User
This is a new information to me. I wonder how the needs file generated for me all these times. May be at some point of time, I must have accidentally compiled the app in debug mode. Thanks for this valuable information.
This is documented (build with debug) somewhere by ab... But where - I can not find at the moment...

As we get tripped up on these issues, please re-visit these sections since I constantly update them - as we users expose our problems...



Both sections were updated to reflect THIS issue. I don't know what else we could do to help us figure these things out (remembering the rules).
That said, has anyone shown us a better framework with the power and simplicity of ABMaterial? I am still waiting for this reveal... (and not holding my breath).
Upvote 0


Licensed User
Longtime User

Added these jump links to (Deployment problems / Tips) sections - to the legend of dummies tutorial...

Bug me to keep these up-to-date. PM me with your issue so we can research, resolve and update dummies section WITHOUT cluttering the forum with many more posts - that don't need to be there...

This particular issue (original post) has cost - at minimum, many hours - for all of us!!!

"We could use a KnowledgeBase for ABM... just thinking...
Could prevent un-needed posts...
Last edited:
Upvote 0


Licensed User
Longtime User
Truly ongoing... Completely forgot about situation 15...
Good thing you remembered.
Upvote 0


Active Member
Licensed User
Longtime User
This particular issue got me pulling my hair for almost 1 day Lol.
In the Demos templates it did work and in my project it did not. I was losing my mind.o_O
Upvote 0