Exemplo n.º 1
0
        public override IFormBuilder <JObject> Field(string name, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null)
        {
            var field = new FieldJson(this, name);

            field.SetActive(active);
            field.SetValidate(validate);
            AddSteps(field.Before);
            Field(field);
            AddSteps(field.After);
            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Define a step for filling in a particular value in a JObject as defined by a JSON Schema.
        /// </summary>
        /// <param name="builder">Form builder.</param>
        /// <param name="schema">JSON schema defining JObject.</param>
        /// <param name="name">Path in the form state to the value being filled in.</param>
        /// <param name="active">Delegate to test form state to see if step is active.</param>
        /// <param name="validate">Delegate to validate the field value.</param>
        /// <returns>This form.</returns>
        /// <remarks>
        /// See <see cref="FieldJson"/> for a description of JSON Schema extensions
        /// for defining your fields.
        /// </remarks>
        public static IFormBuilder <JObject> Field(this IFormBuilder <JObject> builder, JObject schema, string name, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null)
        {
            var field = new FieldJson(schema, name);

            if (active != null)
            {
                field.SetActive(active);
            }
            if (validate != null)
            {
                field.SetValidate(validate);
            }
            return(builder.Field(field));
        }
Exemplo n.º 3
0
        public override IFormBuilder <JObject> Field(string name, PromptAttribute prompt, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null)
        {
            var field = new FieldJson(this, name);

            field.SetPrompt(prompt);
            if (active != null)
            {
                field.SetActive(active);
            }
            if (validate != null)
            {
                field.SetValidate(validate);
            }
            return(Field(field));
        }