Start a conversation

Form with AJAX validation - sc_ajax_message Macro

In this example we will create a form using validation in AJAX Scriptcase event.

Step 1 : Create a simple form, choose the table and we will in the configuration and AJAX Events



Step 2: Now we will choose which field will be used for validation and which event he will be fired


Step 3 : You will bring up a screen to put the code in AJAX onChange event, show an example code for validation amount of products available in stock right now.



Note that we use the macro sc_ajax_message

How to use :

sc_ajax_message (message , title , params , params_redir )

This macro allows the application to display customizable messages, with its use restricted to the form / control events. This macro is only valid in applications with AJAX support.

Parameters Description
Message The message to be shown. This parameter is required.
Title Messagebox title, if this parameter is empty, the title will not be shown.
Message Parameters String Message format parameters.
Ex.: modal=Y&button=Y&button_label=Ok&redir=form_employees.php&redir_target=_blank
For more details about this parameter, see Table2.
Redirecting Parameters String In this section is possible to define values for the redirecting target application. This parameter works only if a "redir" property was informed. The properties for this parameter must be informed in this format: parameter=value;parameter=value.
Ex.: customer_id=ALFKI;customer_name=ALBERT FRANCINET

Table2: Message Parameters String

Property Description Values Example
modal Flag to define if the message will be shown in modal Y or N modal=Y
timeout Time in seconds to hide the message. If this property is not informed, the message will be shown indefinitely. This property works only if "button" property is not enabled. Seconds timeout=5
button Shows a button inside the message. This button default function is to close the message. If there is redirecting enabled, the application will be redirected after closing the message. Y or N button=Y
button_label Button label. This option works only if the "button" property is enabled. String button=Y&button_label=OK
top Message positioning value in pixels from top margin. Pixels Number top=300
left Message positioning value in pixels from left margin. Pixels Number left=200
width Messagebox width value in pixels Pixels Number width=320
height Messagebox height value in pixels Pixels Number height=30
redir URL or application name for redirecting. This macro works only if the "button" property is enabled. String button=Y&redir=form_employees.php
redir_target Target for redirecting. This property works only when the "redir" property is enabled. String redir=form_employees.php&redir_target=_blank
show_close Flag for exhibition of the "close" button on the messagebox title bar. When activated, this parameter forces a title bar to be shown, even if there is no title defined. Y or N show_close=Y
body_icon Flag for exhibiting a icon on the message body. The icon exhibition depends on the applications theme configuration (exhibition schemes). Y or N body_icon=N


Step 4: Now we notice that every time we passed the number that is in stock , the application will display a message that the stock are not available at this time.

 

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Amanda Santos (Migrated deleted Agent)

  2. Posted
  3. Updated

Comments