Support > Repository > Business logic > Input filter
ja | en

You can write a "filter" process to convert the value entered from the Web form by a script. R7.8

Input filter processing can be described as script code.

Figure 1 Script description field

The process written here creates a presentation model inside Wagby from input valuesBeforeIt will be executed.

When you modify the script in Designer, it is immediately reflected in the application on the development machine.You can check the fix without building process.

In Wagby, the value entered from the Web form is "Presentation modelWe manage it.

In the script$ {Model name _ p}I will treat it with the notation.All values ​​are string type.

In the operation of the presentation model, you can obtain the input string by assigning ".content" to the end of the item name.

The following example is a script that supplements the following @, if "@" is not included in the input value of the email item email of the model ID customer.All operations are performed on the presentation model customer_p.

var email = (customer_p.email != null) ? customer_p.email.content : null;
if (email != null && email != "" && email.indexOf("@") < 0) {
    email = email + "@jasminesoft.co.jp";
    customer_p.email.content = email;
}

Wagby's string extended search is AND search by standard.I will introduce a script to change this to "make OR search standard as" when a search condition is entered with a space delimiter ".The model ID is customer and the target item is name.

This script is described in "Input filter (search)".

var cname = (customer_cp.name != null) ? customer_cp.name.content : null;
if (cname != null && cname != "" && cname.indexOf(" ") >= 0 && cname.indexOf("OR ") != 0) {
    cname = "OR " + cname;
    customer_cp.name.content = cname;
}

If a value including a space is entered in the search condition item name and the beginning is not started with "OR", it is assigned.

The search value entered from the Web form is managed by "condition presentation model". In the script, we treat it as $ {model name _ cp}.All values ​​are string type.