Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Adding new row with image field

Avatar

Level 2

Hello All!

I am having trouble getting my image fields to work the way I need them to.  (Sample is attached).  What I need is for the user (who will be using Reader) to enter in text information, then enter in a diagram or exhibit, then, if needed add another set of text and exibit.  I will need each row to be independently added and deleted as well (similar to my text row is already set up).  I have tried having a table set up and repeat the table, but the Image Field will not work properly and shrinks to a small size.  I really would like the user to be able to determine the size.

Is there any way I can do this?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

With the change in structure from the table a new subform was introduced (SystemDiagram). So you have to update your expressions to incorporate this new structure. So on the click event of the ResetForm button the code shoudl look like this:

Content.SystemDiagram.ImageDiagram.DiagramSub.Diagram.rawValue = null;
Content.SystemDiagram.ImageDiagram.DiagramSub.Diagram.h = "0.6813in";

Paul

View solution in original post

12 Replies

Avatar

Former Community Member

Ok here is a modified sample. You have put everything in multiple tables ....I rebuilt your sample without tables (it makes it much simpler). My structure is very straight forward. The add row button is outside the subform and I only need one of those. Then I added code on the exit event of the image field. This will calculate the height of the image and resize the row subform to the right height. Note that when you add the image the border of the row is still there until it is resized then it disappears (after you exit the field).

Hope that helps

Paul

Avatar

Level 2

HI Paul,

Thank you for the input.  I need to spend some time trying this out to see if it will work, but I have one question (please excuse my naiveity).  When I am working with flowed subforms, I have never been able to position my data where I want without using a table as a placeholder.  I see in your sample, I am able to move the rows around the subform (next to each other, under each other with a space, etc).  How did you do that?

Avatar

Former Community Member

The flowed subform means just that flow the information with the subform from top to bottom. If you want to place thing swithin that structure then wrap your content in a positioned subform first. The subform boundaries will define where you can move with the subform (if you need more space then resize the position subform). Then make the root subform flowed.

Paul

Avatar

Level 2

Oh.  I see that now.  I am still having problems making the form work the way I need it to (maybe it is just impossible).  If I take the text field and make it expandable for multiple lines, and since the text field and the Image Field are both in a positioned subform, the text field runs over the Image Field.  Can I just insert another subform and make those two flowed within the form?

Avatar

Former Community Member

Its not that simple .....the subform has dimensions when it is created. The two fields are empty so it creates a boundary for the subform with empty fields. Now you update the fields and change their boundaries. I added code to the exit event of the image that calculates he new size (based on what came in) and then sets the height of the subform accordingly.

Paul

Avatar

Level 2

I am sorry to be such a pain about this, but either I am not understanding what I need to do exactly, or this isn't working the way I need it to.  Attached is the full document.  As you can see, I need the system text and system diagram to be grouped together as one item (and then I have to use the same programming for the exhibits at the end.  At times, the system diagram will be a half page or less, other times, it will span multiple pages.  Also, when management makes changes to the systems, the planners will need to add and remove sections from the middle of the system (insert or delete new rows), very rarely at the beginning or the end of the document.

Attached is the "almost acceptable" document that we are trying to work with.  I have played with the subforms as we discussed and gotten the hide image field to hide the whole DiagramTxt, which tells me I am getting closer, but not quite there yet.

Avatar

Former Community Member

The form seems to be working fine ...can you identify the steps needed to reproduce the issue?

Paul

Avatar

Level 2

HI Paul,

Yes, most of the form works great, with the exeption of the image and text field for the system diagram and I would like to thank you for your patience with me.  Here is what is supposed to happen:

Our systems designers will come up with a diagram that shows the flow of the system in Word or Paint.  It is a process diagram and will need to be input into the form.  Each diagarm (some systems will have one diagram, others will have several) may need the text field to go along with the diagram to explain the jpg diagram.  So, when it is completed, a simplified version will look similar to:

Diagram and Text 1:  The system for making a phone call.

(In a graphic flow chart form) Pick up the phone ------  dial the number-------wait for the other person to answer --------Hold your discussion

Diagram and Text 2:  This is the system for completing the call:

(In a graphic flow chart form) Complete your discussion ------Hang up the phone

Of course, we don't really have systems for making a phone call, but maybe this will help you get the idea.  Additionally, sometimes management will want to add new systems in the middle (say between diagram and text 2, or a supplement to the system after Diagram and Text 2).  Does that make more sense in what I am trying to accomplish?

I need the text and image field to be added and deleted together as a unit.

Avatar

Former Community Member

I think this is what you want ...... I removed the table structure for that row because it was limiting you. I created a new flowed subform around the content that you wanted and modified the code on the buttons.

Have a look and let me know if this is what you want.

Paul

Avatar

Level 2

Awesome!  That is exactly what I need.  The only issue is that, for some reason, my

this.minH

= "0.6813in" in the image fields quit working.  When I hit reset, the image field collapses into a line and no data can be entered.

Avatar

Correct answer by
Former Community Member

With the change in structure from the table a new subform was introduced (SystemDiagram). So you have to update your expressions to incorporate this new structure. So on the click event of the ResetForm button the code shoudl look like this:

Content.SystemDiagram.ImageDiagram.DiagramSub.Diagram.rawValue = null;
Content.SystemDiagram.ImageDiagram.DiagramSub.Diagram.h = "0.6813in";

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----