[CLOSED] TagField : Validate tags

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] TagField : Validate tags

    I think this is not directly related to Ext.net . I have a tagfield with tag bellow
    BasicSalary+ConvenceAllowance+HouseRentAllowance+
    I like to validate this on a buttonclick.

    the string can be dynamic ,like more value separate with operator(operators ).Is it possible to validate with RegExp?please help me to go right direction.

    The tagfield invalid for bellow scenario

    1. +BasicSalary+ConvenceAllowance+HouseRentAllowance
    2. BasicSalary+ConvenceAllowance+HouseRentAllowance+
    3 BasicSalary-+ConvenceAllowance--HouseRentAllowance

    so logic is
    1. tag not start or end with any operator (+,-,*,/,%)
    2. one operand and one operator , should not two operator without operand.
    how do I do this.

    Sample Code

    @{
        Layout = null;
        var X = Html.X();
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
        <script>
    
            var validateTag = function () {
            }
            var addtag = function () {
                App.tag.addTag({ text: 'BasicSalary', value: 1 });
                App.tag.addTag({ text: '+', value: 2 });
                App.tag.addTag({ text: 'ConvenceAllowance', value: 3 });
                App.tag.addTag({ text: '-', value: 4 });
                App.tag.addTag({ text: 'HouseRentAllowance', value: 5 });
    
            }
    
        </script>
    </head>
    <body>
        <div>
    
    
            @X.ResourceManager()
            @(X.TagField()
                .ID("tag")
                .HideSelected(true)
                .Width(800)
    
                .HideTrigger(true)
                .Editable(true)
               .TagLabelConfig(X.TagLabel().AllowDuplicates(true))
                .MultiSelect(true)
    
                )
            @(X.Button().Text("Click")
    .Listeners(l =>
    {
        l.Click.Handler = "validateTag()";
        l.AfterRender.Handler = "addtag()";
    })
    )
        </div>
    </body>
    </html>
    Last edited by Daniil; Jan 16, 2015 at 8:32 AM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] TagField : How to allow duplicate Tag in TagField
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Dec 31, 2014, 1:51 PM
  2. [CLOSED] TagField : Item count
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 30, 2014, 5:44 PM
  3. Store not working with TagField
    By GKG4 in forum 2.x Help
    Replies: 5
    Last Post: Feb 13, 2014, 5:20 AM
  4. [CLOSED] Simple Tagfield from Codebehind.
    By waxby in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 06, 2014, 2:51 PM
  5. Replies: 0
    Last Post: Jul 19, 2011, 3:15 PM

Posting Permissions