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

Question

Question

Disable time fields in a table row when radio button on same row is set to 'Days'

asked on August 12 Show version history

I have a Time Sheet form with a table to report overtime worked. It wasn’t always saving start and end times for overtime worked, because I used a field rule to hide Start Time and End Time, when 'Days' to report was selected from radio button options for Days or Hours (see screenshots below). 

I know if I select 'Save the data when the field is hidden' in the Field Rule, it would fix that issue, but I'm afraid employees might enter times and then change the radio button option to 'Days', hiding Start and End Times which still have values, and that would display an inaccurate count of 'Hours' Worked.

So, I'd like to just disable Start and End Times in a row when 'Days' in that row is selected. I just don't know how in JavaScript to check each row, as it's entered, for a radio button setting. Any help is much appreciated!

time sheet screenshots.png
0 0

Replies

replied on August 12 Show version history

This isn't exactly what you asked for, but one thing I've done is the following:

  1. Set the time entry fields to hide/show based on the drop down
  2. Set them to ignore the values
  3. Create a separate hidden field(s) for your time(s)
  4. Use a calculation to "optionally" save the input from the time field

 

For example,

=IF(INDEX(Days_Or_Hours,ROW())="Hours",INDEX(Start_Time,ROW()),"")

What this does is sets the field equal to the start time input IF hours is selected, or blanks it out if days is selected.

By doing this, you can set your time to hide/show and not have to worry about it wiping out or keeping values when it shouldn't because you're tracking it separately and the calculation decides whether or not to save the values.

Basically you only use the visible fields to "collect" the time, and your hidden field is what you would actually use on subsequent forms and for processing.

 

Afterthought: An added "benefit" to this is that you could use the built-in time field to utilize the drop down and enforce formatting, then have the hidden field be a single line so it appears in plain text on the review/approver form. However, the calculations do seem to get a bit weird when you try to pull a Time field value into a Text field.

1 0
replied on August 12

Thank you, Jason. I hadn't though of that, but it makes sense. 

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

Sign in to reply to this post.