IT Link Solutions Blog | FAQs

How to validate a textbox on focus out in MS LightSwitch Application?

by Administrator 15. April 2016 00:24

 

I am currently working on a LightSwitch HTML client application in which I faced an issue of validating textbox. For example, upon setting up a Boolean Yes/No field to Yes, the relevant text field must contain a value. I figured out that it can be done by using focus out event of that textbox, so I need to find out a way to implement focus out event of a textbox in LightSwitch.
 

You cannot validate a textbox on focus out by using LightSwitch jquery API wrapper. You will have to achieve it by using jQuery focusout event.

 

$(element).find("input").focusout(function () {

        try {

 

            if ($(this).val() && !ValidateEmail($(this).val())) {

                contentItem.screen.findContentItem("EmailAddress").validationResults = [

new msls.ValidationResult(                       

contentItem.screen.PatientApplicant.details.properties.EmailAddress,

"Please enter a valid Email '!'.")

                ];

                $(this).focus();

                returnfalse;

               

            } else

                contentItem.screen.findContentItem("EmailAddress").validationResults = null;

        } catch (e) {}

    });

 

function ValidateEmail(email) {

    var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;

    return expr.test(email);

};

 

It will probably resolve the issue, if not you can always seek help from our MS LightSwitch application experts anytime you want.

Could not load file or assembly Microsoft.LightSwitch, Version=10.0.14.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

by Administrator 7. April 2016 02:31

Could not load file or assembly 'Microsoft.LightSwitch, Version=10.0.14.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

 

In order to get rid of the error you are dealing with, you have to do the following things:

     1. Open up the Visual Studio (whichever you are using)

     2. Once opened, you will see a notification button at right side of the title bar

 

 

 

      3. Click it, now you will see a ‘Notification Window’ right in front of you containing all notifications related to updates

 

     4. Click on any of the notifications

     5. Upon clicking you will see a dialogue box named as ‘Extensions and Updates’

 

     6. Now click on ‘Updates’ and then ‘Product Updates’

     7. Now make sure you have updated all the necessary product updates

 

 

Once you have followed all the above mentioned steps, hopefully you will not experience errors anymore.

In case the issue still persists, you can contact our SharePoint experts.

Could not load file or assembly Microsoft.Data.EDM Version=5.2.0.0

by Administrator 31. March 2016 08:20


I receive following errors whenever I use LightSwitch application on my system which was previously created by someone else:

Could not load file or assembly Microsoft.Data.EDM Version=5.2.0.0
Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0
And any other library like abc.xyz version=1.1.0.0 etc.


What do I really need to do to make it run flawlessly?

First of all please verify the version of the actual referenced dll file with the version mentioned in web.config file.

 

For example in our case we have a reference of Microsoft.Data.EDM Version=5.2.0.0

And we have following code in our web.config.

<dependentAssembly>

        <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />

 </dependentAssembly>

 

Try to replace <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" /> with

<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />.


By the end of the day this will probably fix the issue.

 

 

How can we achieve user’s authorization using custom permissions in LightSwitch while using SharePoint Lists as datasource

by Administrator 22. March 2016 08:13

Basically, these permissions are for forms authentication. If we have SharePoint then SharePoint will take care of such permissions itself.

In your case in which you are using two SharePoint lists as data source it can be used only through SharePoint permissions (like read, view, edit, contribute, and full control).

 
For instance, if a user have got read or write permissions, it will allow access to that user in accordance with the permissions assigned. On the other hand, if a user have got the contribute rights then he will be able to add new items. Moreover, if some items are added using MS LightSwitch application, SharePoint will treat it just like adding items directly through SharePoint ‘add new item form’. Same conditions will apply to other operations like, edit, delete, view etc.


Can I use SPServices from any subsites and site collection

by Administrator 16. March 2016 05:10

You should be able to move the sites up and down in the same site collection pretty simply. The tactic is if you need to go to a different site collection as webservices are tied to the site collection you are on. One of the arguments used is WebURL and it can be used to make sure that you are pointing at the right list or library location you are actually seeking for.

 

The script that is given below may help with your problem:

 

 $().SPServices({

        operation: "GetListItems",

        // Force sync so that we have the right values for the child column onchange trigger

        async: false,

        webURL: "/webs/sitecollection/site", => “URL should be the same as we have the list on that particular site collection”

        listName: "tst",

        // Filter based on the currently selected parent column's value

        // Only get the parent and child columns

        CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",

        // Override the default view rowlimit and get all appropriate rows

        CAMLRowLimit: 0,

        completefunc: function(xData, Status) {

            window.alert(Status);

        }

    });

 

LightSwitch Azure hosted application do not load SharePoint custom list data from other site

by Administrator 14. March 2016 01:20

This query is about light switch applications’ data source

Here the user is trying to say that he has developed some application in Microsoft Visual Studio LightSwitch and used some SharePoint lists as data source.

In that scenario let us clear some basic things first. If you have added some SharePoint lists to your app in LightSwitch you should keep in mind that it is site specific on SharePoint. The domain for the app would only be the site on which you have deployed it. And it will try to locate lists and libraries on the same site on which it is deployed.

Here is the demonstration for it:

 

 

Your site will be working fine if and only if you deploy it to Site ‘A’ but when you deploy this app to Site ‘B’ it will not show any data. Most people think that it might be some sort of permissions issue.

MS LightSwitch app will not remind the site name for the data source rather it reminds only about the lists and libraries names. In this particular case, app will try to find list 1 and list 2 on site ‘B’ when we deploy it on Site ‘B’ and we don’t have any list having these names.

So whenever you try to deploy your LightSwitch app to some other site which is not the same site from where we are fetching data, you must recreate or clone all the lists and libraries to that site as well. One thing interesting here is that, we don’t even need to change a single line in our app, no need to change the site name for data source because, the app will find lists against the site name itself.

 

 

Review Us!

Connect with Us

Tag cloud