Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:32:07+00:00 2026-05-23T05:32:07+00:00

I am working on dynamic form generator. Someone can create fields like: string, text,

  • 0

I am working on dynamic form generator. Someone can create fields like: string, text, boolean, number, file etc.

Are there any gems or guidelines for storing data from such dynamic forms?

I mean I can create a number of tables for each datatype, or I can store all of them as a TEXT with flag wich type it should be converted.

UPD

or I’d better use nosql here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:32:08+00:00Added an answer on May 23, 2026 at 5:32 am

    I believe Mongodb is a right choice for this application, since it doesn’t enforce any schema, its a good choice for arbitrary data.

    As well, it does support all the datatype you have expected. so it is easy.

    Have a form collection which looks like this (Ruby Mongoid code)

      class XForm
      include Mongoid::Document
      include Mongoid::Timestamps
      include Mongoid::Paranoia
    
           field :name, :type => String
           field :user, :type => BSON::ObjectId     
    
           embeds_many :formfields
      end
    

    and

     class Formfields
      include Mongoid::Document
    
         field :name, :type => String
         field :kind, :type => String
         #field :value, :type => String -> dont add it in formfields, make it dynamic sine the type varies
    
      embedded_in :xform
      end
    

    To add value field as a dynamic field, you need to enable allow_dynamic_fields: true in mongoid.yml

    and create a new field like this

      form = XForm.new(:name=>'test form',:user => current_user.id)
       #for integer field
       form.formfields << Formfields.new(:name => "Age",:kind=>"Integer", :value => 21)
       #for bool field
       form.formfields << Formfields.new(:name => "isMarried",:kind=>"Boolean",:value => true)
       #for string field
       form.formfields << Formfields.new(:name => "name",:kind=>"String",:value => "ram")
    

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to create a form which contains a dynamic number of input text
I hope someone can help me..... i am trying to build a dynamic form
I'm working on a long, dynamic form (100 or so fields) and am using
I have a form generating dynamic cookie, say: webform-62[1234356] 62[1234356] can be any number.
I am working on dynamic form generator. And I've noticed strange behaviour class Model
I am working on a project which needs to extract text form a predefined
I am working on rendering a dynamic form in an ASP.NET MVC view that
I working in Java Swing and I am generating a dynamic form with control
I'm attempting to get over the hurdle of dynamic form fields in Rails --
I'm creating a dynamic form builder where table rows can be dragged, dropped, reordered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.