Eagerly validating User Input with Jquery

Below are two bullet points on the Jquery site for validation. They describe the behavior for the JQuery validation plugin, around Lazy and Eagerly validation for user input on a web page.

  • Before a field is marked as invalid, the validation is lazy: Before submitting the form for the first time, the user can tab through fields without getting annoying messages - he won't get bugged before he had the chance to actually enter a correct value
  • Once a field was marked invalid, it is eagerly validated: As soon as the user entered the necessary value, the error message is remove

Based on how the HTML is rendered, this behavior may not be observed. For instance, after calling validate() for a form, eargerly validation(validation on events like Mouseup/down and keyPressUp/down.) does not occur after corrections are made to validated input. To make sure that you get eagerly validation when using straight HTML markup for textboxes, make sure to add the input TYPE and NAME as illustrated below for the html elements. For example, the markup below illustrates the class, 'required number' so the textbox will first be validated to make sure a value is supplied and then it will check if the value is numeric after validating the form submission and then after changes as new data is entered.

<input name="id12" class='required number' type="text" />

Currently rated 1.5 by 11 people

  • Currently 1.454545/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 5/25/2012 at 2:31 AM
Tags: ,
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Re-hosting the WF Designer with WF4.5 Designer Features

At first I thought that I could just re-host the WF Designer in WF4.5 the same way it is done in WF4 and inherit the new WF Designer changes within WF4.5, that were mentioned in my previous post. This is not the case! Although the designer will be re-hosted you need the following code for gain the new designer features...

wfDesigner = new WorkflowDesigner();

wfDesigner.Context.Services.GetService<DesignerConfigurationService>().AnnotationEnabled = true;

wfDesigner.Context.Services.GetService<DesignerConfigurationService>().TargetFrameworkName = new

System.Runtime.Versioning.FrameworkName(".NET Framework", new Version(4, 5));

wfDesigner.Load(new Sequence());

The FrameworkName must eather be '.NET Framework' or '.NETFramework' and make sure that the WF Designer Load method is called last. After adding these changes to the code, the designer will reflect the new features.

Currently rated 1.9 by 30 people

  • Currently 1.866667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 5/16/2012 at 1:39 PM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

New WF4.5 Designer Features Gained while Re-hosting the WF Designer

Hani, from the WF Team, released a post here about the WF4.5 designer features gained while re-hosting the WF Designer outside of Visual Studio like:

  • Outline view of workflow items
  • Designer annotations
  • Multi-select
  • Auto-surround with sequence
  • Pan mode
  • Toolbox search
  • Currently rated 1.8 by 84 people

    • Currently 1.761905/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Posted by: BayerWhite
    Posted on: 5/15/2012 at 3:59 AM
    Actions: E-mail | Kick it! | DZone it! | del.icio.us
    Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

    Retrieving-WF4-Persisted-Workflow-Instances-with-EF43-Code-First

    Entity Framework 4.3 has a first class experience for building a database and tables by using code to describe relational metadata and structure of the tables. As changes to the database need to be made, it is a simple process of changing the code to reflect how the database should change. The cool thing is that an existing database can already exist, and it can be indicated to EF's Code-first, that no modifications need to be made to the database or tables, just read the data.

    There are many ways to get data out of WF4.x's persistence data store, using the views and tables provided and EF's code-first makes it even easier. This example gets all persisted workflow instances from the System.Activities.DurableInstanceing.Instances view:

    Provide the POCO for the Instances view:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.ComponentModel.DataAnnotations;
    using System.Collections.ObjectModel;

    namespace WFPersistence.DataModel
    {
        public class Instance
        {
            public Guid InstanceId { get; set; }
            public DateTime? PendingTimer { get; set; }
            public DateTime? CreationTime { get; set; }
            public DateTime? LastUpdatedTime { get; set; }
            public int? ServiceDeploymentId { get; set; }
            public string SuspensionExceptionName { get; set; }
            public string SuspensionReason { get; set; }
            public string ActiveBookmarks { get; set; }
            public string CurrentMachine { get; set; }
            public string LastMachine { get; set; }
            public string ExecutionStatus { get; set; }
            public bool? IsInitialized { get; set; }
            public bool? IsSuspended { get; set; }
            public bool? IsCompleted { get; set; }
            public byte? EncodingOption { get; set; }
            public byte[] ReadWritePrimitiveDataProperties { get; set; }
            public byte[] WriteOnlyPrimitiveDataProperties { get; set; }
            public byte[] ReadWriteComplexDataProperties { get; set; }
            public byte[] WriteOnlyComplexDataProperties { get; set; }
            public string IdentityName { get; set; }
            public string IdentityPackage { get; set; }
            public long? Build { get; set; }
            public long? Major { get; set; }
            public long? Minor { get; set; }
            public long? Revision { get; set; }
        }

        public class Instances : Collection<Instance>
        {

        }
    }

    Next build the DbContext object as follows:

    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace WFPersistence.DataModel
    {
        public class WFPersistenceStore : DbContext
        {
            public WFPersistenceStore()
                : base("WFPersist") //Name of the connectionstring setting within the App.config
            {
            }

            public DbSet<Instance> PersistedInstances { get; set; }

            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                modelBuilder.Entity<Instance>().ToTable("System.Activities.DurableInstancing.Instances"); //Manages the default schema association with the POCO class
            }
        }
    }

    Query the View:

    private void LoadPersistedInstances()
            {
                var PersistedWFInstances = new Instances();
                try
                {
                    using (var PersistStore = new WFPersistenceStore())
                    {
                        var result = from t in PersistStore.PersistedInstances
                                     select t;

                        foreach (var instance in result)
                        {
                            PersistedWFInstances.Add(
                            new Instance
                            {
                                InstanceId = instance.InstanceId,
                                PendingTimer = instance.PendingTimer,
                                CreationTime = instance.CreationTime,
                                LastUpdatedTime = instance.LastUpdatedTime,
                                ServiceDeploymentId = instance.ServiceDeploymentId,
                                SuspensionExceptionName = instance.SuspensionExceptionName,
                                SuspensionReason = instance.SuspensionReason,
                                ActiveBookmarks = instance.ActiveBookmarks,
                                CurrentMachine = instance.CurrentMachine,
                                LastMachine = instance.LastMachine,
                                ExecutionStatus = instance.ExecutionStatus,
                                IsInitialized = instance.IsInitialized,
                                IsSuspended = instance.IsSuspended,
                                IsCompleted = instance.IsCompleted,
                                EncodingOption = instance.EncodingOption,
                                ReadWritePrimitiveDataProperties = instance.ReadWritePrimitiveDataProperties,
                                WriteOnlyPrimitiveDataProperties = instance.WriteOnlyComplexDataProperties,
                                ReadWriteComplexDataProperties = instance.ReadWriteComplexDataProperties,
                                WriteOnlyComplexDataProperties = instance.WriteOnlyComplexDataProperties,
                                IdentityName = instance.IdentityName,
                                IdentityPackage = instance.IdentityPackage,
                                Build = instance.Build,
                                Major = instance.Major,
                                Minor = instance.Minor,
                                Revision = instance.Revision
                            });

                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
    The results will be loaded within the PersistedWFInstances variable

    Currently rated 1.5 by 31 people

    • Currently 1.483871/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Posted by: BayerWhite
    Posted on: 5/2/2012 at 1:28 PM
    Actions: E-mail | Kick it! | DZone it! | del.icio.us
    Post Information: Permalink | Comments (0) | Post RSSRSS comment feed