<% require "simple_form" unless defined?(SimpleForm) require "active_model/railtie" unless defined?(ActiveModel) example_form_model = Class.new do include ::ActiveModel::Model attr_accessor :example_text_field, :example_phone_field, :example_email_field, :example_number_field, :example_search_field, :example_password_field, :example_url_field, :example_text_area, :example_select_field, :example_collection_select_field, :example_checkbox_field def self.model_name ActiveModel::Name.new(self, nil, "ExampleFormModel") end end %> <% example_collection = [ OpenStruct.new(name: "Alabama", value: 1), OpenStruct.new(name: "Alaska", value: 2), OpenStruct.new(name: "Arizona", value: 3), OpenStruct.new(name: "Arkansas", value: 4), OpenStruct.new(name: "California", value: 5), OpenStruct.new(name: "Colorado", value: 6), OpenStruct.new(name: "Connecticut", value: 7), OpenStruct.new(name: "Delaware", value: 8), OpenStruct.new(name: "Florida", value: 9), OpenStruct.new(name: "Georgia", value: 10), ] %> <%= pb_rails("form", props: { form_system: "simple_form", form_system_options: [example_form_model.new, url: "", method: :get] }) do |form| %> <%= form.input :example_text_field, as: :string %> <%= form.input :example_phone_field, as: :tel %> <%= form.input :example_email_field, as: :email %> <%= form.input :example_number_field, as: :integer %> <%= form.input :example_search_field, as: :search %> <%= form.input :example_password_field, as: :password %> <%= form.input :example_url_field, as: :url %> <%= form.input :example_text_area, as: :text %> <%= form.select :example_select_field, [["Yes", 1], ["No", 2]], props: { label: true } %> <%= form.collection_select :example_collection_select_field, example_collection, :value, :name, props: { label: true } %> <%= form.check_box :example_checkbox_field, props: { text: "Example Checkbox", label: true } %> <%= form.actions do |action| %> <%= action.submit %> <%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %> <% end %> <% end %>