Expand my Community achievements bar.

action on one date/time field changes another one that it should not change

Avatar

Level 1


I am working in Adobe LiveCycle Designer ES2. I have created two date and time fields formatted to just display time which is working well. I have also created a button with and action associated with each field that is set to update the field time when clicked. The actions work on both buttons, however each button changes both fields rather than just the one addressed by the button. I have tried several scripting options and action builder options but I cannot isolate the two fields from the two buttons. The way they are intended to work is, when the form is opened, the user clicks the "start time" button and the current time is entered into the first field. When the user has completed thier task they are to click the second button that is intended to set the current time in the "finish time" field. Somehow these two fields seem to be linked and I have been unable to separate the actions between the two. Am I missing something? Thanks.

Field and Button script:

//+Start Time

   form1.#subform[0].Start_Time[0]::ready:layout - (FormCalc, client)

  $.rawValue = (Num2Time(Time(), "HH:MM:SS"))

    form1.#subform[0].Start_Time[1]::click - (JavaScript, client)

  //+ GENERATED - DO NOT EDIT
(ID:481AA615-BA3C-4085-BFB0-6240244ED76C CRC:853078032)

  //+ Type: Action

  //+ Result2:
SetEnabled("$Node2","readOnly")

  //+ Result1:
SetFieldValue("$Node2","totoday","")

  //+ Node2:
form1[0].#subform[0].Start_Time[0]

  //+ Node1:
form1[0].#subform[0].Start_Time[1]

  //+ Condition1:
Button("$Node1","click")

  //+ ActionName: Start_Time[1].click

  this.resolveNode("Start_Time[0]").rawValue= util.printd("yyyy-mm-dd", new Date());

  oTargetField = this.resolveNode("Start_Time[0]");

      oTargetField.access= "readOnly";

  //-

  //+End Time

  form1.#subform[0].Finish_Time[1]::ready:layout - (FormCalc, client)

  $.rawValue = (Num2Time(Time(), "HH:MM:SS"))

  

form1.#subform[0].Finish_Time[0]::click - (JavaScript, client)

  //+ GENERATED - DO NOT EDIT (ID:FCE1EADA-539C-4189-92F5-77FFDCB15B4B CRC:1724778531)

  //+ Type: Action

  //+ Result2: SetFieldValue("$Node3","totoday","")

  //+ Result1: SetEnabled("$Node2","readOnly")

  //+ Node3: form1[0].#subform[0].Finish_Time[1]

  //+ Node2: form1[0].#subform[0].Start_Time[0]

  //+ Node1: form1[0].#subform[0].Finish_Time[0]

  //+ Condition1: Button("$Node1","click")

  //+ ActionName: Finish_Time[0].click

  oTargetField = this.resolveNode("Start_Time");

      oTargetField.access= "readOnly";

  this.resolveNode("Finish_Time[1]").rawValue= util.printd("yyyy-mm-dd", new Date());

 

//-

2 Replies

Avatar

Level 6

Not certain but I would start by naming the date/time fields something different.  Looks they they are using the default scheme.

Avatar

Level 1

Hi paulk07. Thanks for the suggestions. I tried renaming the fields but that did not resolve the problem. I did remove the action builder code and the buttons still work to change the time without the action code, however they one still changes the other and visa versa. Would you possibly have any other possible solution ideas? Thanks.