• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display data filled in one tab to other using JQuery?

 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have 5 processes A, B, C, X, Y and Z. In UI of each process; there are 5 Tabs have different types of form.

MoneyPayment(2nd Tab) and Approval(5th Tab) is common.

In MoneyPayment Tab, It have a radio, drop down, date, text and textarea in a Panel and which is cloned again and again with ID's say id0,id1,id2. In Approval Tab, It shows data filled by user in radio, drop down, date, text in MoneyPayment screen.

Question: What are different and best approach in JQuery to display filled data from MoneyPayment(in each panel) to approval tab and that function should be common for all processes?
1) To add attribute data-approval="Yes" (But here we need check to final page as suppose A process show this data but B process does not)
2) Everytime pick each element by ID is again long coding.

Anyone please suggest more inputs if someone have shorten approach

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Azrael Noor wrote: which is cloned again and again with ID's say id0,id1,id2.


If this means that the cloned elements are using the same id values, then your HTML is invalid. An id can be used for at most one element on a page. If it means that you are generating ids with subsequent values, then that's really poor and clunky way of creating an association. See below for better ideas.

Question: What are different and best approach in JQuery to display filled data from MoneyPayment(in each panel) to approval tab and that function should be common for all processes?


I'm not 100% clear on what you are trying to do, but my guess is that you have form elements in different parts of that page (within tabs for example), that need to stay in sync with each other as their values are changed. Is that correct?

If so, then I'd set up change handlers for the elements and set the values of the other corresponding elements from the value of the triggered element. Identifying the corresponding elements can be done in a number of ways; but not by id. If they can have the same name, that would work. If not, then considering using a class that can tie the elements together. Or even a custom attribute, if need be.
reply
    Bookmark Topic Watch Topic
  • New Topic