Page 1 of 1

How to prevent time "hours" from being changed

Posted: March 28th, 2018, 5:16 am
by lusia
Dear all,
I have a difficulty regarding systime() function using CSPRO 7.0.1
I want to make the "hours" item can't be changed even though, let's say, I moved back to the item before the "hours" item.
Even if I protect the item using the capture type in the item properties, it didn't worked.
Here is my script:

Code: Select all

PROC TIME_1
onfocus
	//fill in automatically 
	$ = systime("HH");
	noinput;
Kindly please help me.
Thank you before and after.

Regards,
lusia

Re: How to prevent time "hours" from being changed

Posted: March 28th, 2018, 7:49 am
by Gregory Martin
The noinput statement will allow an interviewer to move back into the field. If you never want to allow entry to the field, you should set it to protected.

You can then set it in logic:
PROC TIME_1

preproc

    // fill in automatically only if it is blank
    if visualvalue(TIME_1) = notappl then
        TIME_1 = systime("HH");
    endif;

Re: How to prevent time "hours" from being changed

Posted: March 28th, 2018, 9:04 pm
by lusia
Sorry for the late reply.
I've implemented your script in my code. It worked perfectly.
Thank you very very very much.
:D :D :D

Regards,
lusia