[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

3628.0. "oa$val_set_invalid" by CROCKE::YUEN (Banquo Yuen, Darwin Australia) Sun Dec 05 1993 04:57

Hello

I have a problem in an ALL-IN-1 V3.0A application.

The file CHCL_NODE contains the node name (field NAME) and the
privilege (field PRIV) required to work on this node.  If PRIV is null
means that no privilege is required to work on this node.

The variable #CHCL_PRIV is a list of privileges separated by commas for
the current user.  "ALL" is a special privilege to allow the user to work
on all nodes.

In this particular form, what I want is the user is only allowed to enter
the node he/she has privilege on the field NODE.

The following named data work fines except when the user press RETURN on
the NODE field.  So this form accept node which the user is not privileged
to work on.

********************************************************************************
;;NODE;;

/VALID=CHCL_NODE.NAME
/SHOW='.NAME " " .DESC'
/OPTIONAL
/POST='XOP "~~CHECK_NODE~~"'

;;~~CHECK_NODE~~;;

.IF (#CHCL_PRIV CONTAINING "ALL") OR
    (#CHCL_PRIV CONTAINING CHCL_NODE.PRIV[NODE]) THEN
        GET #CHCL_NODE = NODE
 ELSE
        GET OA$DISPLAY="Insufficient Privilege to work on this node"\\
        OA$VAL_SET_INVALID NODE\\
        OA$FRM_SET_FIELD NODE
********************************************************************************

The OA$VAL_SET_INVALID function seems to have *NO EFFECT AT ALL*.  I have
tried this:

********************************************************************************
/VALID=CHCL_NODE.NAME; .IF (...) THEN OA$VAL_SET_INVALID NODE
********************************************************************************

Nothing happens.

Have tried to include this OA$VAL_SET_INVALID function in the POST function
of the whole form, again nothing happens.

Then I tried the /RSE_VALID qualifier like this

********************************************************************************
/RSE_VALID=CHCL_NODE.NAME WITH (#CHCL_PRIV CONTAINING "ALL") OR
                               (#CHCL_PRIV CONTAINING .PRIV)
********************************************************************************

This works when user press FIND, the list comes up exactly what I want.
However it accepts everything, even the node name not in the CHCL_NODE file.
I guess it is because when the node name is not in CHCL_NODE, .PRIV will
return null.

Then I tried this

********************************************************************************
/RSE_VALID=CHCL_NODE.NAME WITH ((#CHCL_PRIV CONTAINING "ALL") OR
                                (#CHCL_PRIV CONTAINING .PRIV)) AND
                               (#CHCL_NODE.%KEY[.NAME] NES "")
********************************************************************************

Tried that

********************************************************************************
/RSE_VALID=CHCL_NODE.NAME WITH ((#CHCL_PRIV CONTAINING "ALL") OR
                                (#CHCL_PRIV CONTAINING .PRIV)) AND
                               (#CHCL_NODE.%KEY[NODE] NES "")
********************************************************************************

Nothing works.

??? Any suggestion?

??? Can I force the user to stay in a form when the user press RETURN?

??? I have thought about setting a variable so that the form will be
    invoked again if the NODE field is not correct, but it seems crazy?

??? What are OA$VAL_SET_VALID and OA$VAL_SET_INVALID doing?

Thanks
Banquo
T.RTitleUserPersonal
Name
DateLines
3628.4OA$VAL_SET_INVALID does work; suggestions for fixing the problemSCOTTC::MARSHALLSpitfire Drivers Do It ToplessTue Dec 07 1993 12:1223
Hi,

OA$VAL_SET_INVALID *does* work; see US$CHANGE$PASSWORD for examples of its use.
Without playing with your code in more detail (which I don't have time for) I
don't know why it isn't working in your case.

Are you sure the ELSE part is actaully being exectued?  Do you see the message
�nsufficient priv..."?

Try OA$FLD_STAY instead of OA$FRM_SET_FIELD.

Try replacing your /VALID with some functions that explicitly set the field
to valid/invalid, rather than validating it then having to have post-processing
to invalidate it again!

eg: /VALID=<.IF CHCL_NODE.NAME[NODE] NES "" AND
           ((#CHCL_PRIV CONTAINING "ALL") OR
            (#CHCL_PRIV CONTAINING CHCL_NODE.PRIV[NODE])) THEN OA$VAL_SET_VALID
           ELSE XOP "~~INVALID~~"

Then ~~INVALID~~ can print the message, call OA$VAL_SET_INVALID, OA$FLD_STAY, etc

Scott
3628.5When to use OA$VAL_SET_INVALIDIOSG::TALLETTGimmee an Alpha colour WinPad!Mon Jan 10 1994 16:4238
    
    	OA$VAL_SET_INVALID is very rarely needed and difficult to
    	understand. It helps to know the sequence of events when
    	validating a form.
    
    	When a user enters a field and moves off it (eg TAB or RETURN)
    	then ALL-IN-1 calls your validation. If it is valid, ALL-IN-1
    	sets a flag for that field to say that it has been validated.
    	This flag is unset if the user alters the contents of the field.
    	When the user hits RETURN to finish the screen, ALL-IN-1 goes
    	through the form, and for each field that has not yet been
    	validated, it calls the validation for that field. If the field
    	is invalid, processing stops at that field. If all the fields
    	are valid, ALL-IN-1 *THEN* executes any /POST processing.
    
    	So you see, calling OA$VAL_SET_INVALID in the /POST processing
    	will not work, ALL-IN-1 is already past the point of no return.
    
    	The time to use OA$VAL_SET_INVALID is if you have two fields
    	that depend on each other:
    
    		First Field			Second Field
    		    1				ONE
    		    2				TWO
    
    	Imagine the user must enter in the second field, the text
    	corresponding to the number in the first field. If you didn't have
    	OA$VAL_SET_INVALID, you could enter "1" then "ONE" then backspace
    	to the first field and enter 3 and hit RETURN. Because the field
    	validation for the second field has set the flag to valid on the
    	first time through, it will not get re-validated. For this reason
    	the validation of the first field should contain a
    	OA$VAL_SET_INVALID SECOND_FIELD
    
    	See, I told you it was hard to understand, didn't I??!! :-)
    
    Regards,
    Paul