Example #1
0
 internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
 {
     foreach (var option in _options)
     {
         if (option.Selected && !option.Disabled)
         {
             dataSet.Append(Name, option.Value, Multiple ? "select-one" : "select-multiple");
         }
     }
 }
Example #2
0
 /// <summary>
 /// Constucts the data set (called from a form).
 /// </summary>
 /// <param name="dataSet">The dataset to construct.</param>
 /// <param name="submitter">The given submitter.</param>
 internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
 {
     if (this == submitter)
     {
         return;
     }
     else if (Type == ButtonType.Submit || Type == ButtonType.Reset)
     {
         dataSet.Append(Name, Value, Type.ToString());
     }
 }
Example #3
0
        internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
        {
            for (int i = 0; i < _options.Length; i++)
            {
                var option = _options.GetOptionAt(i);

                if (option.IsSelected && !option.IsDisabled)
                {
                    dataSet.Append(Name, option.Value, Type);
                }
            }
        }
        /// <summary>
        /// Constucts the data set (called from a form).
        /// </summary>
        /// <param name="dataSet">The dataset to construct.</param>
        /// <param name="submitter">The given submitter.</param>
        internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
        {
            dataSet.Append(Name, Value, Type.ToString());

            if (_attributes[AttributeNames.DirName] != null)
            {
                var dirname = _attributes[AttributeNames.DirName].Value;

                if (String.IsNullOrEmpty(dirname))
                {
                    return;
                }

                dataSet.Append(dirname, Dir.ToString().ToLower(), "Direction");
            }
        }
Example #5
0
        protected void ConstructDataSet(FormDataSet dataSet, String type)
        {
            dataSet.Append(Name, Value, type);

            if (HasAttribute(AttributeNames.DirName))
            {
                var dirname = GetAttribute(AttributeNames.DirName);

                if (String.IsNullOrEmpty(dirname))
                {
                    return;
                }

                dataSet.Append(dirname, Direction.ToString().ToLowerInvariant(), "Direction");
            }
        }
Example #6
0
        /// <summary>
        /// Constructs the form data set with the given submitter.
        /// </summary>
        /// <param name="submitter">[Optional] The submitter to use.</param>
        /// <returns>The constructed form data set.</returns>
        FormDataSet ConstructDataSet(HTMLElement submitter = null)
        {
            var formDataSet = new FormDataSet();

            foreach (var field in _elements)
            {
                if (field.ParentElement is IHtmlDataListElement)
                {
                    continue;
                }
                else if (field.IsDisabled)
                {
                    continue;
                }

                field.ConstructDataSet(formDataSet, submitter);
            }

            return(formDataSet);
        }
Example #7
0
        /// <summary>
        /// Constructs the data set (called from a form).
        /// </summary>
        /// <param name="dataSet">The dataset to construct.</param>
        /// <param name="submitter">The given submitter.</param>
        internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
        {
            var type = Type.ToEnum(InputType.Text);

            switch (type)
            {
            case InputType.Radio:
            case InputType.Checkbox:
            {
                if (IsChecked)
                {
                    var value = Keywords.On;

                    if (!String.IsNullOrEmpty(Value))
                    {
                        value = Value;
                    }

                    dataSet.Append(Name, value, Type);
                }

                break;
            }

            case InputType.Image:
            {
                if (!String.IsNullOrEmpty(Name))
                {
                    var name = String.Empty;

                    if (!String.IsNullOrEmpty(Value))
                    {
                        name = Value + ".";
                    }

                    var namex = name + "x";
                    var namey = name + "y";

                    //TODO get x and y of submitter and save those
                    dataSet.Append(namex, "0", Type);
                    dataSet.Append(namey, "0", Type);
                }

                break;
            }

            case InputType.File:
            {
                if (_files.Count == 0)
                {
                    dataSet.Append(Name, String.Empty, MimeTypes.Binary);
                }

                foreach (var file in _files)
                {
                    dataSet.Append(Name, file, Type);
                }

                break;
            }

            case InputType.Text:
            case InputType.Search:
            {
                ConstructDataSet(dataSet, Type);
                break;
            }

            default:
            {
                dataSet.Append(Name, Value, Type);
                break;
            }
            }
        }
 /// <summary>
 /// Constucts the data set (called from a form).
 /// </summary>
 /// <param name="dataSet">The dataset to construct.</param>
 /// <param name="submitter">The given submitter.</param>
 internal virtual void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
 {
 }
 /// <summary>
 /// Constucts the data set (called from a form).
 /// </summary>
 /// <param name="dataSet">The dataset to construct.</param>
 /// <param name="submitter">The given submitter.</param>
 internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
 {
     ConstructDataSet(dataSet, Type);
 }
Example #10
0
        /// <summary>
        /// Constructs the data set (called from a form).
        /// </summary>
        /// <param name="dataSet">The dataset to construct.</param>
        /// <param name="submitter">The given submitter.</param>
        internal override void ConstructDataSet(FormDataSet dataSet, HTMLElement submitter)
        {
            switch (Type)
            {
            case InputType.Radio:
            case InputType.Checkbox:
            {
                if (Checked)
                {
                    var value = "on";

                    if (!String.IsNullOrEmpty(Value))
                    {
                        value = Value;
                    }

                    dataSet.Append(Name, value, Type.ToString());
                }

                break;
            }

            case InputType.Image:
            {
                if (!String.IsNullOrEmpty(Name))
                {
                    var name = String.Empty;

                    if (!String.IsNullOrEmpty(Value))
                    {
                        name = Value + ".";
                    }

                    var namex = name + "x";
                    var namey = name + "y";

                    //TODO get x and y of submitter and save those
                    dataSet.Append(namex, "0", Type.ToString());
                    dataSet.Append(namey, "0", Type.ToString());
                }

                break;
            }

            case InputType.File:
            {
                if (_files.Count == 0)
                {
                    dataSet.Append(Name, String.Empty, MimeTypes.Binary);
                }

                foreach (var file in _files)
                {
                    dataSet.Append(Name, file, Type.ToString());
                }

                break;
            }

            case InputType.Text:
            case InputType.Search:
            {
                dataSet.Append(Name, Value, Type.ToString());

                if (_attributes[AttributeNames.DirName] != null)
                {
                    var dirname = _attributes[AttributeNames.DirName].Value;

                    if (String.IsNullOrEmpty(dirname))
                    {
                        break;
                    }

                    dataSet.Append(dirname, Dir.ToString().ToLower(), "Direction");
                }

                break;
            }

            default:
            {
                dataSet.Append(Name, Value, Type.ToString());
                break;
            }
            }
        }