Exemple #1
0
        internal static IReadOnlyCollection <EtherealComponent> GetLogInHiddenFieldsAndSetUpClientSideLogic(DataValue <string> clientTime)
        {
            setCookie(testCookieName, "No data");

            var timeHiddenFieldId = new HiddenFieldId();

            return(new EwfHiddenField(
                       "",
                       id: timeHiddenFieldId,
                       validationMethod: (postBackValue, validator) => clientTime.Value = postBackValue.Value,
                       jsInitStatementGetter: id => "$( document.getElementById( '{0}' ).form ).submit( function() {{ {1} }} );".FormatWith(
                           id,
                           timeHiddenFieldId.GetJsValueModificationStatements("new Date().toISOString()"))).PageComponent.ToCollection());
        }
        private static IReadOnlyCollection <EtherealComponentOrElement> getLogInHiddenFieldsAndSetUpClientSideLogic(DataValue <string> clientTime)
        {
            EwfPage.Instance.PreRender += delegate { setCookie(testCookieName, "No data"); };

            HiddenFieldId timeHiddenFieldId = new HiddenFieldId();
            var           timeHiddenField   = new EwfHiddenField("", (postBackValue, validator) => clientTime.Value = postBackValue.Value, id: timeHiddenFieldId);

            EwfPage.Instance.PreRender +=
                delegate {
                EwfPage.Instance.ClientScript.RegisterOnSubmitStatement(
                    typeof(UserManagementStatics),
                    "formSubmitEventHandler",
                    timeHiddenFieldId.GetJsValueModificationStatements("new Date().toISOString()"));
            };

            return(timeHiddenField.PageComponent.ToCollection());
        }