This function can be used in AutoPlay Media Studio 5.0 Professional to determine whether an input object is empty (i.e. has no text in it). This is primarily useful for performing simple data validation, for example to make sure a user has entered something in a required field before jumping to another page.

This function also demonstrates a naming technique that lets you create "categorized" functions that resemble the built-in actions in AutoPlay. You simply create a table and then define the function as an item in that table. (This is in fact how the built-in actions are done, although with some extra behind-the-scenes autocomplete and quickhelp magic.)

Code:
-- create the InputTest table if it doesn't already exist
if not InputTest then InputTest = {}; end

--[[
Function:	InputTest.IsEmpty
Purpose:	Determine whether there is any text in an input object.
Arguments:	(string) ObjectName - The name of the object you want to test.
Returns:	true if the input object is empty, or false if there is text in it.
--]]
function InputTest.IsEmpty(ObjectName)
	return String.Length(Input.GetText(ObjectName)) == 0;
end
Here is a short example demonstrating how you might call the function. Insert this example code in the On Click event for an object on a page that has an input object named "Input1" on it.

Code:
if(InputTest.IsEmpty("Input1")) then
	Dialog.Message("Um...","The input box is emptier than a deflated balloon.");
else
	Dialog.Message("Ah...","There appears to be text in the input box. (Tell Desmond to clean his car.)");
end
Requirements:

Note: this function will only work with AutoPlay Media Studio 5.0 Professional Edition, since the Standard Edition does not have an input object.