jQuery modal window removes elements from my form

前端 未结 6 1945
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 14:00

jQuery, when i use it to create a modal window which contains form elemets, it takes out those elements when i submit the form.

example of the form:

<         


        
6条回答
  •  隐瞒了意图╮
    2021-02-08 14:27

    This article describes how to solve your problem:

    You’ll see that the content we had mid-way through our page has been marked up with additional classes and, most importantly, placed at the bottom of the page immediately before the closing tag. Why is this important? Because it also means that any ASP.Net controls you place within this dialog will also appear at the bottom of the page, outside of the page’s tag. This means you won’t be able to get a handle to them on postback.

    What’s the solution? Well, there are two options:

    1. Move the elements back to the form, and manually submit when the button is clicked
    2. Clone the elements when you create the dialog, then clone the values back, trigger click on the original button (or, if you only have one or two values to post back, simply assign the values to an ASP.Net hidden field control).

提交回复
热议问题