Making custom form check for user input in required fields
- Article Type: General
- Product: Aleph
- Product Version: 20
Description:
Question related to the custom input form: How can the custom form be configured to check for user input in required fields, and prevent the job from being submitted until the fields are filled in?
Aleph jobs like p_manage_21 check for the presence of the input file, and for the output filename and don't allow the process to run until both are filled in correctly. I want to do the same for a custom service we're developing, but haven't found validation elements in p-manage-21.xml or documentation that describes how that functionality is enabled.
Resolution:
The reason that p_manage_21 requires the input file to be present is that the ./butil/b_manage_21_check_param.cbl program calls the b_check_file_name routine with the data the user has input as the value:
MOVE 100 TO L.
CALL "len_count" USING
P-INPUT-FILE
L
END-CALL.
CALL "pic_to_lower" USING
P-INPUT-FILE
L
END-CALL.
CALL "b_check_file_name" USING
P-FILE-OUT
P-FILE-OUT-INDEX
"Y"
BUF-ERROR
BUF-ERROR-REPLACE
BUF-ERROR-POSITION
END-CALL.
The third line in the CALL "b_check_file_name" (Y") is the SW-MANDATORY parameter/value.
In your case you should find that the make_param_files proc (using ./copy/P_CUST_nn.source as input) has generated a ./butil/b_cust_nn.cbl program. You could add a section of code like the above, with the following lines appended:
IF BUF-ERROR NOT = 0
THEN
CALL "add_error" USING
BUF-ERROR
5001
END-CALL
END-IF.
Then recompile with "iprou butil b_cust_nn" and restart the pc_server.
- Article last edited: 10/8/2013