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 8184433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:30:02+00:00 2026-06-07T01:30:02+00:00

i have a form tag and users can dynamically create the form by clicking

  • 0

i have a form tag and users can dynamically create the form by clicking on the elements they would want to be in that form . By clicking the elements get appended inside the form tag .

This is the function that is called .

function add_element(element)
{
    var startdiv = "<div class='form_content_middle_box' id = 'div"+i+"' onclick='javascript:edit(\""+element+"\",\""+i+"\");'> <a href='javascript:void(0);' onclick='javascript:remove("+i+");'>Delete</a></br>";
    var enddiv = "</div>";

    switch(element)
    {
        case 'textbox' :
            $('#myform_container').append(startdiv + "<label id='label"+i+"'>Untitled Textbox</label><p id='paragraph"+i+"'><input type = 'text' id='"+i+"'/></p>" + enddiv);
            form_elements.push(element);
            //alert(form_elements);
        break;
        case 'number' :
            $('#myform_container').append(startdiv + "<label id='label"+i+"'>Untitled Textbox</label><p id='paragraph"+i+"'><input type = 'number' id='"+i+"'/></p>" + enddiv);
            form_elements.push(element);            
        break;
        case 'textarea' :
            $('#myform_container').append(startdiv + "<label id='label"+i+"'>Untitled Textarea</label><p id='paragraph"+i+"'><textarea id='"+i+"'></textarea></p>" + enddiv);
            form_elements.push(element); 
           // alert(form_elements);
        break;
        case 'checkbox' :
            $('#myform_container').append(startdiv + "<label id='label"+i+"'>Untitled Checkbox</label><p id='paragraph"+i+"'><input type = 'checkbox' id='"+i+"' /></p>" + enddiv);
            form_elements.push(element);
        break;
        case 'radio' :
            $('#myform_container').append(startdiv + "<label id='label"+i+"'>Untitled MultipleChoice</label><p id='paragraph"+i+"'><input type = 'radio' id='"+i+"'/></p>" + enddiv);
            form_elements.push(element);
        break;
        case 'dropdown' :
            $('#myform_container').append(startdiv + "<label id='label"+i+"'>Untitled SelectBox</label><p id='paragraph"+i+"'><select id='"+i+"'><option></option></select></p>" + enddiv);
            form_elements.push(element);
        break;

        default:
        break;
    }

    i++;
}

After the form has been created , the user will click on save and i need to save that form ,
i want to know a way to get all the elements and the values that the user has appended.A way to save the form along with all the elements in an array or something

  • 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-06-07T01:30:04+00:00Added an answer on June 7, 2026 at 1:30 am

    Try

    var myElements=$('#myformID').find('input, textarea, button, select')
    

    The variable myElement will be cast to an array and will have all the elements in the form.

    Iterating through the variable myElements[index] will give the form element and
    myElements[index].value will give the form elements value

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

Sidebar

Related Questions

I have a form where users can enter tags like tag1,tag2,tag3. I explode that
In my HTML code, I have a form tag that contains two input boxes,
I have a form on my site that lets users direct a message at
I have a form I'm trying to set up ... Users can have many
I have a form on my site where users can submit text as part
I have items and buttons that are created dynamically and I want to show
I have this form tag below where the form submits to itself which I
I have this form: <%= form_tag posts_path, :method => :get, :class => search_nav do
I would like to have Ajax form in Rails so i'm using form_remote_tag. The
I have the following LINQ query: From metasect In DirectCast(Form.ChildDocBox.Tag, META_DOCUMENT).META_SECTIONS From metaset In

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.