Tutorial: Using Ajax Button

This example demonstrates the use of AJAX button on a control form.

Creating a Control Form

1. Create a new application Control type.

2. In the application menu open the “Fields” folder and then click on the item “New Field”

3. We will create three fields. Enter the name and the label fields according to the table below:

Name Label
info Informações
browser Navegador
language Idioma

4. In the application menu click the item “Buttons >> New button” and select the type “Ajax”.

5. We will use the following code on the button.


if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
} else {
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);

if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) 
$browser = 'Internet explorer';
elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE) 
$browser = 'Mozilla Firefox';
elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE) 
$browser = 'Google Chrome';
if($lang == "pt")
{info} = "Hoje é ".date('d-m-Y').", ".date('H:i:s')." e seu IP é: ".$ip;
{info} = "Today is ".date('d-m-Y').", ".date('H:i:s')." and your IP is: ".$ip;
{browser} = $browser;
{language} = strtoupper($lang);

6. Click the Run button on the toolbar.

Tutorials in the same category

Form with special fields

In this example, we'll see how to configure a couple of Scriptcase special fields, in a form applica...

Master-Detail (Single-to-Single)

In this example, a Master / Detail complete application, where we get an edit form of categories and...

Generate PDF from Forms

In this example we will see how to configure the application form to display the button to print the...

Form Mobile

Scriptcase Form applications are generated with mobile responsiveness automatically. Selectin...

Comment this post