locked
HTML Client - execute code on button no longer working RRS feed

  • Question

  • As my project has expanded I have noticed that in some cases, when I create a screen, and then add a custom button, no matter what I write in the "Execute" code, the button does nothing...

    even using the example window.open("http:\\www.google.co.uk"); nothing happens... this is becoming a major issue as now every screen I create, I cannot link it to an external web page, the commands within Lightswitch still work but anything external doesnt...

    I hope someone has a solution to as it has completely halted my progress. I am using: Visual Studio Professional 2013 (Update 4)

    the issue

    the printscreen above is what I have done, and this does not work so is there anything you can think off which will fix this issue?


    Cr7

    Tuesday, June 2, 2015 9:52 AM

Answers

  • In my scenario I had some custom HTML templates in an extension built in VS2013 RTM. The templates worked fine. The desktop and HTML clients ran fine, only problem was any custom control render and custom command execute could not be found and were not executed.

    I removed the extension and then the HTML client now works as expected. So I am guessing that with VS2013 Update 4 also came a refresh of a DLL or two, some clash.

    If you look in the json you will see modules including any and all project extensions, even Silverlight extensions in the HTML client :O (you can delete most of these from the json after a build).

    So that was my problem, perhaps it was different than yours Crezzer, but similar symptoms.

    Cheers

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Angie Xu Monday, June 22, 2015 9:04 AM
    • Marked as answer by Angie Xu Wednesday, June 24, 2015 5:48 AM
    Wednesday, June 3, 2015 9:04 PM
  • ... and the news is I managed to reproduce the problem in a new project in a couple of minutes. So I am looking some more.

    UPDATE: It seems the problem only happens if building and debugging in the same VS instance that the extension is activated. If you activate an extension, close VS, reopen and all is fine :)

    UPDATE: the generated 'model.json' file is different I have the before and after (though they ought to be identical :) So Microsoft.LightSwitch.Extensions has a breaking change in VS2013 Update 4!

    Sorry for polluting the thread with a different problem!

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.




    • Edited by Xpert360 Thursday, June 4, 2015 8:47 AM Microsoft.LightSwitch.Extensions
    • Proposed as answer by Angie Xu Monday, June 22, 2015 9:04 AM
    • Marked as answer by Angie Xu Wednesday, June 24, 2015 5:48 AM
    Thursday, June 4, 2015 7:36 AM

All replies

  • Are you able to set a break point and does the debugger find it?

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Tuesday, June 2, 2015 4:11 PM
  • First, I would do a Build then Rebuild solution

    Also, can you create a new page, with a name that you have never used before, create a method, set a break point, and see if it works.


    Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book

    http://LightSwitchHelpWebsite.com

    Tuesday, June 2, 2015 4:22 PM
  • the re-build and build does not do anything, however using a new name does work. I often test a screen before programming it with a button and window.alert("Hello"); as soon as this works then I begin programming. I will re-iterate that this issue does appear to only happen when using google chrome, its always works in IE... im assuing based on all the arguments betweem Microsoft and Google recently that this has something to do with it, thanks for your advice.

    Cr7

    Tuesday, June 2, 2015 4:28 PM
  • Tuesday, June 2, 2015 4:45 PM
  • if i open it up in IE first, then go into debug mode in chrome it works 100% of the time (so far at least) but sometimes it also works with a new page in chrome with a new name. I must need to delete some stored files in the Lightswitch project that are faulty or theres something weird going on with my PC

    Cr7

    Wednesday, June 3, 2015 7:05 AM
  • So is the 'window.open' or 'window.alert' appearing not to work or does it never get to run the *_execute javascript code?

    For 'window.open' I usually specify a target like '_blank' (even though it is the default).

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Wednesday, June 3, 2015 7:12 AM
  • well seems how I cannot get it to run in debug mode I can't tell if it is the code it doesn't like, but the weird thing is, if i was to put some validation before the command, then it would show an error message if one of the criteria wasn't met, so the only thing I can say with confidence is that the problem keeps linking back to Chrome. As this doesnt happen in IE or infact Firefox and Safari after some more testing yesterday


    Cr7

    Wednesday, June 3, 2015 7:19 AM
  • Hey Crezzer,

    I may have joined your exclusive club. Working on a test project here I am finding screens with custom control render events and custom command handlers not being found.

    This is in IE11 as well. As it is a simple app I can debug it and find out what is wrong. Never seen this before, and this is VS2013 Update 4 too, new project.

    I'll be back.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Wednesday, June 3, 2015 5:31 PM
  • Are you sure Chrome is using your latest sources too?

    F12, network tab, disable cache. Reload with F12 developer tools open (disable cache will only work with the dev tools open).

    Perhaps chrome is still fetching the JS from it's cache


    Keep rocking LS!
    Jan

    PS: have you seen app-stitch yet? It's a visually simple yet powerful way of designing business rules for Visual Studio LightSwitch apps.

    Wednesday, June 3, 2015 7:54 PM
  • In my scenario I had some custom HTML templates in an extension built in VS2013 RTM. The templates worked fine. The desktop and HTML clients ran fine, only problem was any custom control render and custom command execute could not be found and were not executed.

    I removed the extension and then the HTML client now works as expected. So I am guessing that with VS2013 Update 4 also came a refresh of a DLL or two, some clash.

    If you look in the json you will see modules including any and all project extensions, even Silverlight extensions in the HTML client :O (you can delete most of these from the json after a build).

    So that was my problem, perhaps it was different than yours Crezzer, but similar symptoms.

    Cheers

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Angie Xu Monday, June 22, 2015 9:04 AM
    • Marked as answer by Angie Xu Wednesday, June 24, 2015 5:48 AM
    Wednesday, June 3, 2015 9:04 PM
  • What version of Chrome are you using? I have not been able to reproduce this. I would also make sure you haven't defined the function elsewhere (its unlikely if you are using the default method signature, but I have seen this in the past where two function are basically the same as far as JavaScript is concerned and it only runs the last one it sees without telling you.) If you have a project that repro's consistently can you open a http://connect.microsoft.com/ bug and share it?

    -Thanks


    Patrick Baker (Senior Software Engineering Manager)

    Wednesday, June 3, 2015 10:01 PM
    Moderator
  • Thanks Dave that was helpful. When you had a problem I ran to my contacts at Microsoft and basically asked, "just to be clear, there is someone on the other end to address issues like this, right?"

    The answer was that LightSwitch will be supported for at least another 5 years, and 5 years extended support after that period of time.


    Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book

    http://LightSwitchHelpWebsite.com

    Wednesday, June 3, 2015 10:46 PM
  • I thought I would go back and look at the test project again today.

    I added back the custom template extension and went through all scenarios that came to mind and the HTML client and the custom render and command events are found and run fine. I have several other projects using the same extensions and they have never had a problem.

    So a bit of a mystery. I will try to reproduce my initial steps with a new project again.

    Cheers

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Thursday, June 4, 2015 7:26 AM
  • ... and the news is I managed to reproduce the problem in a new project in a couple of minutes. So I am looking some more.

    UPDATE: It seems the problem only happens if building and debugging in the same VS instance that the extension is activated. If you activate an extension, close VS, reopen and all is fine :)

    UPDATE: the generated 'model.json' file is different I have the before and after (though they ought to be identical :) So Microsoft.LightSwitch.Extensions has a breaking change in VS2013 Update 4!

    Sorry for polluting the thread with a different problem!

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.




    • Edited by Xpert360 Thursday, June 4, 2015 8:47 AM Microsoft.LightSwitch.Extensions
    • Proposed as answer by Angie Xu Monday, June 22, 2015 9:04 AM
    • Marked as answer by Angie Xu Wednesday, June 24, 2015 5:48 AM
    Thursday, June 4, 2015 7:36 AM
  • Out of interest, does the Chrome specific issue crop up if you try Google Chrome's 'bleeding edge' build (Chrome Canary)?

    We're currently investigating a situation where a HTML client custom control stops responding to click events.  This problem very occasionally occurred in the past but has become endemic on Chrome in the last few days (maybe following the last 25th of May Chrome update).  

    However, having just tried Google's Canary release, it seems to resolve the issue.


    Thursday, June 4, 2015 8:02 AM
  • i shall try this aswell to see how things go... thanks for the suggestion 

    Cr7

    Wednesday, June 24, 2015 6:49 AM
  • did you create a new project and copy the model.json file from there? or is there somewhere specific i can go to, to get this file?

    Cr7

    Wednesday, June 24, 2015 6:50 AM