You are viewing limited content. For full access, please sign in.

Question

Question

Change time value in date and time field

asked on March 5, 2023 Show version history

Hi all, 

 

Not sure if this is possible via a calculation, but I was looking to make it easier for my user to select a 'Fully Day" "Half Day" Option which would automatically set the time value in a Date and Time field to a set time e.g 8:00am. 

 

Is it possible to do this via a calculation, I have been searching but not come across anything. I am on 11.2

 

I've tried something like this but no success

 

=IF(Radio_Button = 2, "8:00:00 AM", "5:00:00 PM")

Thanks

 

0 0

Answer

SELECTED ANSWER
replied on March 5, 2023

Hi Shan,

If you are using the classic form designer, you can try with this formula, =IF(EQ(Radio_Button, 2), "08:00:00 AM", "05:00:00 PM"), which works for me.

If you are using the new form designer, I'd recommend use its Javascript feature in latest Forms release, which supports lots of built-in functions to control your fields, see https://doc.laserfiche.com/laserfiche.documentation/11/administration/en-us/Default.htm#../Subsystems/Forms/Content/Javascript-and-CSS/JavaScript-in-the-Forms-Designer.htm?TocPath=Forms%257CCreating%2520a%2520Form%257C_____9 for more information.

And in your use case, you can do something like:

//fieldId: 1 is Time, fieldId: 2 is Radio
//Trigger when radio is selected
LFForm.onFieldChange(function(){
if(LFForm.getFieldValues({fieldId: 2}).value=="HALFDAY"){
  LFForm.setFieldValues({fieldId: 1}, {timeStr: "08:00:00 AM"});
}
else{
  LFForm.setFieldValues({fieldId: 1}, {timeStr: "05:00:00 PM"});
}
}, {fieldId: 2})

 

1 0

Replies

replied on March 6, 2023

Thank you very much Zhiyong,

 

Ahh it is such a shame I cannot upgrade to the latest Update 3 as we have some core forms which rely heavy on scripts built in the classic forms.

Also strange the calculation doesn't work on the Modern Forms in 11.2

 

Thank you very much for your help I will assess my options.

 

0 0
replied on March 6, 2023

Hi Shan,

 

Glad to hear it works. As for new form, I already filed a bug for it, the bug id is 416788.

1 0
replied on March 6, 2023

Appreciated!

0 0
replied on July 19, 2023

Hi, This bug has been fixed in new form on Forms 11 Update 4.

You can see other changes from:

List of Changes for Laserfiche Forms 11 Update 4 - Knowledge Base

Get Forms 11 Update 4 from Laserfiche 11 package:

Software versions and fixes included in the Laserfiche 11 Download Package - Knowledge Base

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.