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.

javascript in form - copying a value

Avatar

Former Community Member

I have a form with one field that I want to have a different field's value.  This is done in a claculate event (the only event with any scripts on this field).

I have an "alert" popup that shows the proper value is being assigned to the field, but when the form displays, numeric "1" comes up instead of the expected numeric "60".

1) is there any way to check that this field isn't being changed somewhere else?  There are 27 pages in this form and a lot of fields on each so I don't want to have to go field by field.

2) what event or thing happens after the calculate event (last line is a popup and shows the right value) and the display of the form?

3) when I'm in the event, do I have to qualify the other fields on the form?

4 Replies

Avatar

Former Community Member

The easist way to do this is to make sure the fields have the same name and that the binding is set to global.

To answer your questions ...if that is the only script in your form then it is not coming fom somewhere else.

Yes you will have to qualify fields in other locations than where you are calling your script form.

Paul

Avatar

Former Community Member

There may be many scripts within the 27 pages of this PDF.  On that specific field (page 3, subform2, coreHours10), there is only one event, a calculate one.

Here is that event-script:

Comment #1: I force a value because the data is too hard to manipulate.

Comment #2: this alert box displays expected "60"

The original working version only included the stuff between "//CU6" and "// override" below it.  I don't understand some of that, specifically the "else" on the radiobuttons, but I didn't write it and once I get my part (category 06) done, I'll visit that code.

When the form displays, a "1" is seen in CoreHours10 and not the expected "60".  Something must be changing the value of the field between this calculate event and the alert box and the final display to the user.

Avatar

Former Community Member

I woudl need to see the form in action ...can you post it here or send it to LiveCycle8@gmail.com

Paul

Avatar

Former Community Member

I don't think they will allow it, but I will ask.  I know I can't give the data even if I could think of an easy way to transport a database system.