Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Simple Gadget - Cannot read property 'guid' of undefined

$
0
0

Hello,

I am building a simple gadget where I have some inout fields and a Submit button that executes a javascript to read the form fields and display a result on the gadget.

I read a number of articles, looked at the QuickChat sample but whetever I do, I can't make it work.

if I include the [Gadget(ClientScriptInitMethod = "URLBuilderGadget.init")] instead of [Gadget], I receive the following message which is displayed before the form:

Cannot read property 'guid' of undefined

The javascript is very simple:

require(["dojo/domReady!"],(function($, epi) {
        epi.URLBuilderGadget = function () {
      // object returned by function.
      // Exposes public methods and variables.
      var pub = {};
      pub.init = function(e, gadget) {
          $(this).bind("epigadgetsubmit",
          gadgetSubmit);
      };
      var gadgetSubmit = function (e, gadget)
      {
          alert('Submit Click');
      };
      return pub;
  } ();
} (epiJQuery, epi)));

The Index.cshtml is:

@{
    Layout = null;
}
<div>
    <form id="url-builder-form" action="#" onsubmit="return false;" class="epi-formArea">
        <fieldset>
            <legend>URL Builder</legend>
            <div class="epi-size25">
                <label for="WebsiteURL">Website URL</label>
                <input id="WebsiteURL" class="epi-size3" type="text" />
            </div>
            <input type="submit" value="Submit">            
        </fieldset>
    </form>
</div>

The submit action is not working. 

This is on EPiServer 7.5.

Many thanks

Yannis


Viewing all articles
Browse latest Browse all 9076

Trending Articles