1
votes

Here is my datePicker control where expression validation works fine:

<xp:inputText id="inputComboUntil">
    <xp:this.converter><xp:convertDateTime pattern="MMM d, yyyy"></xp:convertDateTime></xp:this.converter>
    <xp:this.validators>
        <xp:validateExpression>
            <xp:this.expression><![CDATA[#{javascript:var var1 = getComponent("inputDate").getValue();
                if(var1!=null){
                    var var1D:NotesDateTime = session.createDateTime(var1);
                    var var2D:NotesDateTime = session.createDateTime("Today");  
                    var2D.setNow();

                    if(var1D.timeDifference(var2D) < 0){ 
                        return false;
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }}]]>
            </xp:this.expression>
            <xp:this.message><![CDATA[You cannot set date in the past]]></xp:this.message>
        </xp:validateExpression>
    </xp:this.validators>
    <xp:dateTimeHelper id="dateTimeHelper3"></xp:dateTimeHelper>
</xp:inputText>

But if I pick another correct date it seems the validation works with the old one so then fails with validation error. I have nothing in onChange event. Assume picking new date should refresh validation. Note: I have this problem on Domino 8.5.3

1

1 Answers

1
votes

Try getSubmittedValue() instead, but note the value will be a String, not a Date.

Basic partial refresh lifecycle is:

  1. RESTORE_VIEW - get server-side map of the page (component tree)
  2. APPLY_REQUEST_VALUES - push string values entered into browser into components' submittedValue property
  3. PROCESS_VALIDATIONS - check submittedValue properties can be converted to correct datatype and pass validation
  4. UPDATE_MODEL_VALUES - convert submittedValue and write to value property, clearing submittedValue property
  5. INVOKE_APPLICATION - run SSJS
  6. RENDER_RESPONSE - calculate HTML to output