B4J Question WebApp - Get form-data with a websocket

Discussion in 'B4J Questions' started by moster67, Jul 24, 2019.

  1. moster67

    moster67 Expert Licensed User

    I have a simple form in a web-page and when I click the submit button, I can see the values in webdev-tools in Chrome (network-tag).
    I gave the form an ID and it triggers correctly in B4J but the map (Params) does not contain the values. It only contains values such as which=1, metaKey=false, pageY=268 etc).
    How can I get values from the fields in my form in B4J so I can use them for further processing such as validation, entering data in a DB?
    I am using WebSockets.
  2. Erel

    Erel Administrator Staff Member Licensed User

    moster67 likes this.
  3. moster67

    moster67 Expert Licensed User

    Thanks, and it works fine.
    We are really fortunate thanks to all the stuff Erel has built for us.

    Erel's example is using a form to get a file. If you wish to get the values of a text field, checkbox, radio, dropdowns (select) etc from a form, then just use the method GetValue like below:

    Public Sub GetFieldData(parts As Map)
    Dim myfielddata As Part = parts.Get("notes")
    'do something with the data
        ws.Flush 'this is a server event so we need to explicitly call Flush
    End Sub
    Erel and DonManfred like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice