Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORKFormStepViewController issue with Incorrect Section Rendering for Form Items #1557

Open
iadereggalternova opened this issue Nov 14, 2023 · 0 comments

Comments

@iadereggalternova
Copy link

I'm running into a display issue in "ORKFormStepViewController" where form elements of multiple types are not rendering correctly. Specifically, form elements for text fields (both single-line and multi-line), dates, and times are not visually separated into their intended sections. Rather, they appear obfuscated or grouped with the previous question.

Expected Behavior

Each form item type should be displayed in its own distinct section within the form step interface. The visual layout should clearly separate text fields, date pickers, and time pickers into groups that reflect the structure of the form.

Current Behavior

Form items are not being displayed in separate sections. For example, text fields (single and multiple lines) are shown without the necessary spacing or separators, leading to a cluttered interface where distinct elements are difficult to identify. Date and time pickers similarly do not have their dedicated sections, which causes confusion for the end-user. Sometimes, the question appear grouped with the previous question.

Steps to Reproduce

  1. Create a ORKFormStep with a variety of form items, including single-line text, multi-line text, date, and time.
  2. Present the form using ORKFormStepViewController.
  3. Observe that the different form item types are not sectioned off properly.

Code sample

let formStep = ORKFormStep(identifier: "formStep", title: "Survey", text: "Please answer the following questions.")

let answerTextFormat = ORKAnswerFormat.textAnswerFormat()
answerTextFormat.placeholder = "My name is: "
answerTextFormat.multipleLines = true
let textItem = ORKFormItem(identifier: "textItem", text: "¿What is your name?", answerFormat: answerTextFormat, optional: false)

let singleChoiceItem = ORKFormItem(identifier: "singleChoiceItem", text: "Choose an option: ", answerFormat: ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: [
    ORKTextChoice(text: "Option 1", value: 0 as NSNumber),
    ORKTextChoice(text: "Option 2", value: 1 as NSNumber),
    ORKTextChoice(text: "Option 3", value: 2 as NSNumber),
    ORKTextChoiceOther.choice(withText: "Other", detailText: "", value: 3 as NSNumber, exclusive: true, textViewPlaceholderText: "Tap to write your answer")
]))

let multipleChoiceItem = ORKFormItem(identifier: "multipleChoiceItem", text: "Select all the options you consider necessary: ", answerFormat: ORKAnswerFormat.choiceAnswerFormat(with: .multipleChoice, textChoices: [
    ORKTextChoice(text: "Option 1", value: 0 as NSNumber),
    ORKTextChoice(text: "Option 2", value: 1 as NSNumber),
    ORKTextChoice(text: "Option 3", value: 2 as NSNumber),
    ORKTextChoiceOther.choice(withText: "Other", detailText: "", value: 3 as NSNumber, exclusive: false, textViewPlaceholderText: "Tap to write your answer")
]))

let scaleItem = ORKFormItem(identifier: "scaleItem", text: "Select value:", answerFormat: ORKAnswerFormat.scale(
        withMaximumValue: 10,
        minimumValue: 1,
        defaultValue: 5,
        step: 1,
        vertical: false,
        maximumValueDescription: "Max",
        minimumValueDescription: "Min")
)

let dateAnswerFormat = ORKDateAnswerFormat(style: .date)
let dateItem = ORKFormItem(identifier: "dateItem", text: "What is your birth date?", answerFormat: dateAnswerFormat, optional: false)

let timeOfDayAnswerFormat = ORKTimeOfDayAnswerFormat()
let timeItem = ORKFormItem(identifier: "timeItem", text: "What time do you usually wake up?", answerFormat: timeOfDayAnswerFormat, optional: false)

formStep.formItems = [singleChoiceItem, textItem, scaleItem, multipleChoiceItem, dateItem, timeItem]

Screenshots

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant