Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to help you retrieve the selected value(s) faster, we have created more plugin-specific SIL routines.

CategoryUsed withRoutineReturn value
Single value fields
  • text
  • text area
  • select list
  • radio group
  • single checkbox(optional)
BA_getSingleValue(argv, label)String representing the value entered or the selected option for the given label. For checkbox it will return "checked" if the checkbox was selected or an empty string otherwise.
Multi value fields
  • multi select list
  • checkbox group
BA_getMultiValues(argv, label)String array representing the selected options.
  • file upload (since v. 2.5)
String array containing pairs of original filename and uploaded path. Even indices will contain original filenames, while odd indices will contain uploaded path. See Examples for usage.
Checkbox
  • single checkbox
BA_isChecked(argv, label)Convenience method for checking whether a checkbox is selected or not. Returns a boolean: true if the box was checked, false otherwise.

Date

(since v2.0.8 and 2.6.1)

  • date picker
  • date time picker
BA_getDateValue(argv, label)Will retrieve a date value from the argv array. Note that for the date time picker, the value in the argv variable uses the user's time zone. BA_getDateValue will convert this value from the user's time zone to the server time zone.


Note

These methods are only available in versions 1.0.1+ and 2.0.1+

 

For example, take the following Screen Script:

...

You might also use these in conjunction with array-specific routines like arrayGetElement and arrayElementExists. See Array Routines for a list of available routines that manipulate arrays.

 

Anchor
ValidatingScreenFields
ValidatingScreenFields

Validating the Screen Fields 

Once you have a screen that requires additional user input, it is necessary to validate that input and let the user know if s/he did something wrong. This can be done by returning values from the script.

Generic Errors

Generic errors show up in the upper part of the screen, as demonstrated below.

...

Code Block
string fruit = getElement(argv, 1);

if( isNull(fruit) ){
	return "What? You don't like fruits?";
}

Field Validation Errors

If you have multiple input fields on the screen, it would be nice to validate them all at once and show errors for each one.

...

Code Block
string fruitLabel = getElement(argv, 0);
string fruit = getElement(argv, 1);

string chocolateLabel = getElement(argv, 2);
string chocolate = getElement(argv, 3);

string [] errors;

if( isNull(fruit) ){
 	errors = addElement(errors, fruitLabel);
	errors = addElement(errors, "What? You don't like fruits?");
}

if( chocolate != "yes" and chocolate != "of course"){
	errors = addElement(errors, chocolateLabel);
	errors = addElement(errors, "No way!");
}

return errors;

Examples

Example 1

Iterating over uploaded files

...