Wiki

Clone wiki

javarosa / FormEntryAPI

The FormEntryAPI is designed to make form processing and iteration possible from a pure Java environment. It should be able to input an XForm and generate question at a time interaction.

FormEntryModel

FormEntryModel represents the form (FormDef) and data model (DataModelTree).

FormEntryController

FormEntryController is given a FormEntryModel and is used to iterate through the form returning FormEntryPrompt.

  • getFormTitle() - returns form title
  • getFormLanguages() - returns list of form languages
  • getFormProgress() - returns completeness of form entry
  • isAtBeginning() - returns true if form entry is at beginning
  • isAtEnd() - returns true if form entry is at end
  • getCurrentPrompt() - returns current prompt
  • getNextPrompt() - returns next prompt
  • getNextNPrompts() - returns next N prompts
  • getPreviousPrompt() -returns previous prompt
  • getPreviousNPrompts() - returns previous N prompts
  • setPromptAnswer() - sets the prompt answer
  • getPrompt() - returns to a specific prompt
  • getPromptID() - returns unique identifier for prompt
  • readFormFromFile() - reads XForm from file
  • readInstanceFromFile() - reads saved instance from file
  • writeInstanceToFile() - writes saved instance from file

FormEntryPrompt

FormEntryPrompt wraps everything needed to display one form element. Very similar to FormElementBinding.

  • getPromptType() - returns prompt control type (start, end, repeat, select1, input, upload, etc)
  • getPromptHierarchy() - returns XPath expression necessary to select node
  • getPromptAttributes() - returns any XML attributes associated with the prompt
  • getPromptText() - returns prompt label as string
  • getPromptCount() - returns number of times this node has been repeated
  • getAnswerType() - returns answer data type (string, int, decimal, etc.)
  • getAnswerObject() - returns answer value as object (string, double, date, etc.)
  • getAnswerText() - returns answer value as string
  • getConstraintText() - returns constraint value as string
  • getHintText() - returns hint value as string
  • isRequired() - returns true if prompt is required
  • isReadOnly() - returns true if prompt is readonly
  • isRepeatable() - returns true if prompt is repeatable

Updated