Need a date field to be locked upon first signature

Avatar

Avatar

islandgirl23

Avatar

islandgirl23

islandgirl23

07-07-2020

Hello,  Please help me find a solution to this.  I have a form that has a "current" date field.  I would like for that date field to be locked when the first signature block is signed.  I tried to use the action builder, but I could not figure it out.  If you can provide a script, that would be appreciated.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Kosta_Prokopiu1

Employee

Avatar

Kosta_Prokopiu1

Employee

Kosta_Prokopiu1
Employee

31-07-2020

Hi @islandgirl23,

I guess you used scripting for filling the date text field like so

kprokopi_1-1596199961243.png

When I call it without a signature the time is changed every time.

kprokopi_2-1596200005491.png

kprokopi_4-1596200108896.png

When I signed it the time stays

kprokopi_5-1596200217181.png

Place the date calculation inside an if such as this (status changes to 1 when the field has been signed).

 

if (event.target.getField("form1[0].#subform[0].SignatureField1[0]").signatureInfo().status == 0) {
  var datum = new Date();
  this.rawValue = datum.toISOString()
}

actually, I have this script in the date field. form1.headersubform.HEADERS.todaydate::ready:layout - (FormCalc, client) $.rawValue = Num2Date(Date(), "YYYY-MM-DD"). Should I add an if calculation to this? Also, what does "datum.toISOtring() mean?
datum.toISOString() is a quick way to display a datetime in a text field for testing with Javascript - it produces the string in my example. You can cut away the time part - but I used the full string as I cannot detect if the date has changed or not. This is JavaScript and should do the same as your script. Just I have it in the initialize script and not in ready.layout. reday.layout is not the most suitable event for this kind of calculations. If you want the date only with the ISO string then use this.rawValue = datum.toISOString().substring(0,10) - that gives you the same result as your FormCalc. So, try to remove your formcalc from read.layout and place my script in the initialize of your date field. Obviously you need to adapt the field name and SOM of the signature field to your values.

Answers (1)

Answers (1)

Avatar

Avatar

radzmar

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

385

Correct Answer

485

Avatar

radzmar

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

385

Correct Answer

485
radzmar
MVP

09-07-2020

You don't need a script. Just select the signature field and define a new collection under the Signature tab of the Object pallette. 

The collection defines those fields to be locked by the signaure.

 

radzmar_0-1594319026221.png