TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: jquery ui coding help?

1 点作者 bakztfuture超过 12 年前
I don't usually see threads related to coding help on HN but I have had no luck on stack overflow or the jquery UI forums and am desperately in need to further advance a personal project. I have found HN to have a strong concentration of individuals well versed in jQuery and the javascript language, so any help available would be most sincerely appreciated and am deeply sorry if this is not the right place. ============================================================================================================================<p>Essentially, I have a form with a button that creates input fields. Once that input field is created, users are given the option to click the "add media" button which allows them to paste a link inside of an additional input field created. The first set of input fields are "sortable" and can be moved into different positions in the list.<p>When a new add media field are created and the form is submitted, how can I figure out which parent input field it belongs to? I need to be able to know which parent it belongs to so I can transfer the data via jSON and process it with php.<p>the main snippet of code that I have written which creates the JSON data can be found on the SO thread: http://stackoverflow.com/questions/14065552/organizing-values-of-child-elements-for-processing-of-a-draggable-form<p>any help would be sincerely appreciated, thank you!

1 comment

primaryobjects超过 12 年前
Instead of just posting the values to the server, why don't you pass the element IDs as well? You can then name your "link" elements with a key substring that matches the parent element. When you get your postback, you can match the "links" with their parent "step" via the key. This way, you don't rely on the index value in an array. For example:<p>&#60;input id="step1" /&#62;<p>&#60;input id="step1_link1" /&#62;<p>&#60;input id="step2" /&#62;<p>&#60;input id="step2_link1" /&#62;<p>&#60;input id="step2_link2" /&#62;