0

I need to create a lightning component : in this component there is some fields that the user will complete, and a button. I need to get the previously entered values when the button is clicked, and to display a line (of an array maybe ? Beacause it will have several lines possibly if the button is clicked more than once) with theses values displayed (like a recap of the entered values).

I don't know how to do that, if I need to create 2 components (one for the "form" part and one for the 'list" part) and how can I create dynamically a part of a component ? Or should I need to use event to create the "list" component ?

To reformulate, I think I need to create a list of lines, that will be set dynamically (line by line, when the button will be clicked)

closed as unclear what you're asking by glls, battery.cord, Brian Mansfield, Derek F, Himanshu Jun 27 '18 at 3:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Not exactly an answer, but generally, you start with however you think it should be done, then when things get complicated, you break it down into smaller and smaller components. Breaking it down into smaller components is an intuition thing after you learn more of how lightning works. So, in other words, all of those designs work but you can always refactor big components into smaller, whereas smaller to bigger is more troublesome. – tsalb Jun 25 '18 at 15:15
  • 1
    This is especially important if you are creating managed packages....One you package a lightning component it can never be deleted. Even with the delete components option enabled. So if you mess up and include one, your only options is to remove the body and leave it hanging out there – Eric Jun 25 '18 at 16:30
3

This is a bigger question than it may sound to you. Lucky for you, there happens to be a tutorial following a very similar use-case on Trailhead. It may take a while but the lesson will be much more valuable and considered than a brief answer you receive to this question, which is too broad as is.

Check it out here: https://trailhead.salesforce.com/modules/lex_dev_lc_basics/units/lex_dev_lc_basics_prereqs

Not the answer you're looking for? Browse other questions tagged or ask your own question.