API Field Numbers

Hi,

I can’t get my time picker to be restricted as per the sample code in the online docs.

Basically my URL to me view/field is:

./pages/scene_27/views/view_61/form/inputs/rows/0/columns/0/inputs/0

and the code I’ve tried is:

/* Change the field and view numbers to match the view and field in your app.*/
$(document).on(‘knack-view-render.view_61’, function(event, view, data) {
$(‘#view_61-field_0-time’).timepicker(‘option’, ‘minTime’, ‘2:00pm’);
$(‘#view_61-field_0-time’).timepicker(‘option’, ‘maxTime’, ‘11:30pm’);
});

Any ideas what I’m doing wrong?

Thanks in advance

Lee.

Hello Lee,

Try below
$(document).on(‘knack-view-render.view_61’, function(event, view, data) {
$(‘#view_61-field_0-time’).timepicker({minTime: ‘2:00pm’,maxTime: ‘11:30pm’});
});

Thanks,
Sunny Singla
ssingla1985@gmail.com
+919855089359

1 Like

Hi Sunny,

Firstly thanks for your prompt help.

It still doesn’t work and I feel it’s because I have the wrong view or field number title. As you can see in my URL from the original post it’s got rows/0/coulmns/0/inputs/0 etc. so do I need to specify these too?

Cheers

Lee.

Hi Sunny,

Ignore that, I’ve got it working! I was using the field number from the page and not the field number from the schema. So basically it’s field 66 not 0.

The online help really should explain how to obtain these correctly.

Thanks again

Lee.