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

  • Home
  • SEARCH
  • 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 7085163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:23:27+00:00 2026-05-28T07:23:27+00:00

I have following HTML: <form action=/Config.aspx/SDKHome/SaveSections id=SaveSections method=post> <input name=[0].SchemaName type=hidden value=contactSection /> <ul

  • 0

I have following HTML:

   <form action="/Config.aspx/SDKHome/SaveSections" id="SaveSections" method="post">
                <input name="[0].SchemaName" type="hidden" value="contactSection" />

            <ul creator="attrCreator" data-dojo-type="dojo.dnd.Source" class="section container dojoDndSource"
                style="list-style-type: none;">

                <li class="dojoDndItem">
                            <input name="[0].DefinedAttributes[0].SchemaName" type="hidden" value="firstname" />
                </li>

                <li class="dojoDndItem">
                            <input name="[0].DefinedAttributes[1].SchemaName" type="hidden" value="jobtitle" />
                </li>
            </ul>
   </form>

I want to add this item to the list:

            <li class="dojoDndItem">
                        <input name="[X].DefinedAttributes[Y].SchemaName" type="hidden" value="itemToAdd" />
            </li>

How can I replace X and Y (and increment this values by all following items), to have following html as result:

   <form action="/Config.aspx/SDKHome/SaveSections" id="SaveSections" method="post">
                <input name="[0].SchemaName" type="hidden" value="contactSection" />

            <ul creator="attrCreator" data-dojo-type="dojo.dnd.Source" class="section container dojoDndSource"
                style="list-style-type: none;">

                <li class="dojoDndItem">
                            <input name="[0].DefinedAttributes[0].SchemaName" type="hidden" value="firstname" />
                </li>

            <li class="dojoDndItem">
                        <input name="[0].DefinedAttributes[1].SchemaName" type="hidden" value="itemToAdd" />
            </li>


                <li class="dojoDndItem">
                            <input name="[0].DefinedAttributes[2].SchemaName" type="hidden" value="jobtitle" />
                </li>
            </ul>
   </form>
  • 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-28T07:23:28+00:00Added an answer on May 28, 2026 at 7:23 am

    Try this :

    dojo.require("dojo.dnd.Source");   
    dojo.ready(function(){
        var ul = dojo.query("ul.section").pop();
        var lastLiInput = dojo.query("ul li:last-child>input").pop();
        var lastLiInputName = dojo.attr(lastLiInput, "name");   
        var X = 1 + parseInt(lastLiInputName.replace(/.*DefinedAttributes\[(\d+)\].*/, '$1'));
        var newLi = dojo.create("li", { class : "dojoDndItem" }, ul);
        dojo.create("input", {
            name : "[0].DefinedAttributes[" + X + "].SchemaName",
            type : "hidden",
            value : "otherValue"
        }, newLi); 
    });
    

    Not sure the selectors I used will work in all browsers, but you get the idea… regex to get each X and Y, increment, and place at the right position using dom selectors. Just adapt that to your dnd logic…

    See demo here, with visible inputs rather than hidden : http://jsfiddle.net/psoares/FSCdW

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

Sidebar

Related Questions

I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
Suppose I have the following HTML: <form id=myform> <input type='checkbox' name='foo[]'/> Check 1<br/> <input
i have the following html code : <FORM name=frmmail> <input id=dochtmlContent type=hidden name=dochtmlContent value=oldValue/>
in the form action i have the following line\ <form action={URL} method=post target=_self id=xxx
I have the following html form <form action=/newPost id=submit_new method=get><div class=iwill> <div class=iwill-holder> <div
I have the following fom: form id=login_form class=fancy_form action=@Url.Action(Logon, Account) method=POST> <div class=bl_label> Eneter
I have the following action declared in my struts.xml: <action path=/updateAccountInfo type=org.myCompany.UpdateAccountAction name=myAccountForm scope=session
I have the following multi-select box in a HTML form, where user can select
I have a simple MVC form with the following elements: <%= Html.TextBox(FechaInicio) %> Which
I have the following HTML <select> element: <select id=leaveCode name=leaveCode> <option value=10>Annual Leave</option> <option

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.