Summary

This script runs when the initials question of a study is saved on any form. In this case, the script is expecting a format of 3 consecutive capital letters or one capital letter, a hyphen, and another capital letter, in that order. If that format is not found, it fires an alert to the user to indicate that the response should be modified. This alert is optional so the user can proceed without making the correction. If this is a required format (primary or secondary identifier of the application), the correction should be set to “required”. 


Script

<script scriptId="validateInitials">
    <body>
        <s:alert>
            <s:expression>
                <s:regex pattern="[A-Z][A-Z|-][A-Z]">
                    <s:stringPath path=":value"/>
                </s:regex>
            </s:expression>
            <s:correction>
                <s:string value="optional"/>
            </s:correction>
            <s:text>
                <s:string value="The SUBJECT INITIALS should be three characters
                 (non-numeric) in length.  If subject does not have a middle
                 initial, please insert a - for the middle initial.  Please verify the
                 subject's initials."/>
            </s:text>
        </s:alert>
    </body>
    <target typeId="subjinit" action="update" when="preprocess" shouldReconcile='true'/>
</script>



Need more help?

Please visit the Fountayn Contact Information page.