Sodium: Türkiye'nin Programlama Dili
  • Sodium Home Page
  • Getting Started
    • Examples
      • Hello World Example
      • Datalist & Select Element Usage
  • Installation & Configuration
  • Frequently Asked Questions
  • How to
    • How to: use Recordset variable and to_json function for populating a tree node
    • How to: get selected tree node id
    • How to: create master detail relationship between data blocks
    • How to: use data list element for populating select elements
    • How to: define a lookup element for a select element
    • How to: use database sequence in data block element
  • Contributers
  • Roadmap
  • About Me
  • Version History
    • Change Log
    • Things To Do
    • Known Issues
  • LANGUAGE REFERENCE
    • Program Structure
      • Form File
      • Code Behind File
      • Controller File
    • Built-in Functions
      • Sodium Built-in Functions
        • Database Related Functions
          • commit
          • rollback
          • delete
          • create_postgresql_connection
          • create_oracle_connection
          • create_mysql_connection
          • get_database_type
          • get_database_name
          • run_sql_file
          • set_active_database_connection
        • REDIS Functions
          • create_redis_connection
          • close_redis_connection
          • (redis-variable-name).set
          • (redis-variable-name).get
          • (redis-variable-name).del
          • (redis-variable-name).ping
          • (redis-variable-name).incr
          • (redis-variable-name).incrBy
          • (redis-variable-name).decr
          • (redis-variable-name).decrBy
          • (redis-variable-name).strlen
          • (redis-variable-name).append
        • Other Functions
          • disable_column
          • enable_column
          • hide_block
          • hide_column
          • message
          • populate_datalist
          • prompt
          • refresh_block
          • show_block
          • show_column
          • show_page
          • populate_tree
          • to_json
          • refresh_tree_node
          • set_datablock_property
      • Built-in String Functions & Operands
        • instr
        • strlen
        • Concatanation Operator
        • replace
        • substr
        • The "sizeof" Operator
        • Like & Not Like Operators
      • File IO functions
      • Date/time Functions
    • Built-in Triggers
      • "item_modified" trigger
      • "connection_not_found" trigger
      • "page.access" trigger
      • "page_load" trigger
      • "post_query" trigger
      • "row_selected" trigger
      • "button_item_clicked" trigger
      • "pre_insert" Trigger
      • "pre_delete" Trigger
      • "pre_update" Trigger
      • "post_insert" Trigger
      • "post_delete" Trigger
      • "post_update" Trigger
      • "tree_node_expanded" Trigger
      • "tree_node_selected" Trigger
      • "user_session_end" trigger
    • TAGs
      • Data Block
        • Data Block: Form View Mode
        • Data Block: Grid View Mode
        • Data Block: Mix View Mode
      • Control Block
      • Data List
      • Tree Element
      • Table TAG
      • Inputs
        • Text Item
        • Radio Item
        • Select Item
        • Checkbox Item
        • Button Item
        • Image Item
        • Textarea Item
        • Magic Buttons
    • Native SQL support
    • Lexical Elements
      • Identifiers
      • Keywords
      • Constants
        • The Null Statement
        • String Constant
      • Operators
      • Separators
      • White Space
      • Variables
        • Variable Type: int
        • Variable Type: char
        • Variable Type: bool
        • Local variables
        • Page variables
        • Session variables
        • Predefined Variables
          • :Session.authenticated
          • :Session.user
          • :Session.Id
          • :Session.user
          • :Row.Id
      • Functions
        • Function Declarations
        • Calling Functions
        • Function Parameters
        • Recursive Functions
      • Statements
        • The "if" Statement
        • The while Statement
        • The do Statement
        • Code Blocks
        • The break Statement
        • The return Statement
      • Expressions And Operators
        • Expressions
        • Assignment Operators
        • Arithmetic Operators
        • Comparison Operators
        • Logical Operators
        • Function Calls as Expressions
        • Operator Precedence
        • Order of Evaluation
      • Escape Character
    • CSS Themes
    • Scopes
    • Connection
      • Active Database Connection
      • Connection Types
        • Database Connections
        • REDIS Connection
  • Development
    • IDE
    • Debugging
  • SODIUM DEVELOPMENT
    • Sodium Development Home Page
    • Getting Started
      • Sodium Architecture
      • Development Environment
        • Source Code
        • Applications Required
        • Compiling C Projects
        • Compiling NodeJs Project
        • Troubleshooting
Powered by GitBook
On this page
  • Step 1: Folder Creation
  • Step 2: Control File
  • Step 3: Form File
  • Step 4: Code Behind File
  • Output
  • Video

Was this helpful?

  1. Getting Started
  2. Examples

Hello World Example

PreviousExamplesNextDatalist & Select Element Usage

Last updated 5 years ago

Was this helpful?

Step 1: Folder Creation

Create a new sub folder named HelloWorld under the Sodium-Site\apps folder of the installation path.

Step 2: Control File

Controller File: Create a file named controller.sqlx. It will be empty. For more information about .

Step 3: Form File

Form File: Create a file named HelloWorld.frmx and copy/paste the code block showed below into the file.

<!DOCTYPE html>
  
<html>
    <head>
        <title>Hello World</title>

    </head>
  
    <body>
        
        <br />
        <br />

        <controlblock control-block-name="cbDemo">
            <input name="say_hello_world" type="button" value="Say Hello World" style="display: block; margin-left: auto; margin-right: auto; width: 150px;"/>
            <br/>
            <input name="something" type="text" style="display: block; margin-left: auto; margin-right: auto; width: 150px;"/>
            <input name="say_something" type="button" value="Say Something" style="display: block; margin-left: auto; margin-right: auto; width: 150px;"/>
        </controlblock>
  
    </body>
</html>

Form File Explanation:

Step 4: Code Behind File

Code behind File: Create a file named HelloWorld.sqlx and copy/paste the code block showed below into the file.

void page.load() {
    message('Page loaded');
}

void cbDemo.say_hello_world() {
    message('First Application', 'Hello World', 'info');
    message('First Application', 'Hello World', 'notice');
    message('First Application', 'Hello World', 'success');
    message('First Application', 'Hello World', 'error');
}

void cbDemo.say_something() {
    message('Say', :cbDemo.something, 'error');
}

Code behind Explanation:

Output

Video

It is a plain html file. The only difference is a controlblock tag on the lines between 14 and 19 with a name control-block-name="cbDemo". For more information on control blocks, please follow the link .

There is nothing special about the input tag in the control block. For more information on buttons, please follow the link .

Each form file must have a code behind file in the same directory. Code behind files has the same name but with sqlx extension. For more information on Code Behind files, please follow the link .

In the , function is used in order to show a message on the client browser.

In order to open page, write the form file path into the address bar of the Internet browser (). After each file request, "Page loaded" will be shown. After click on "Say Hello World" button, "Hello World" message will be shown on four times with different style.

controller file
Control Block
Button Item
Code Behind File
"page_load" trigger
message
http://localhost:8089/Sodium-Site/apps/helloworld/helloworld.frmx