Skip to content

Instantly share code, notes, and snippets.

View jakearchibald's full-sized avatar
💭
Tired

Jake Archibald jakearchibald

💭
Tired
View GitHub Profile
glow.events.addListener(theForm, 'submit', function() {
// do your ajax stuff here
// prevent the form submitting
return false;
});
glow.events.addListener(theForm, 'submit', function() {
// do your ajax stuff here
// prevent the form submitting
return false;
});
<div id="panel1">
<p>This is my first Panel</p>
</div>
<div id="panel2">
<p>This is my second Panel</p>
</div>
<p><a href="#" id="showFirstPanel">Show first panel</a></p>
<p><a href="#" id="showSecondPanel">Show second panel</a></p>
glow.ready(function() {
// create your panel, this will take it off the page
// the form must have id="form" for the below to work
var myPanel = new glow.widgets.Panel("#form");
// listen for clicks on the "Enquire Now!" button
// The "Enquire Now!" button must have id="enquireNow"
glow.events.addListener('#enquireNow', 'click', function() {
// show the panel
myPanel.show();
glow.ready(function() {
var myPanel = new glow.widgets.Panel("#formPanel");
//display panel
myPanel.show();
})
var MyClass;
(function() {
MyClass = function() {
this.val = 2;
}
MyClass.prototype.publicFunction = function() {
return privateFunction.call(this);
var functions = [],
functionsLen = 0;
function buildMassiveString() {
// build a ~1mb string
return new Array(1024*1024).join('#');
}
function addListener() {
var massiveString = buildMassiveString();
var functions = [],
functionsLen = 0;
function buildMassiveString() {
return new Array(1024*1024).join('#');
}
function addFunction() {
var massiveString = buildMassiveString();
functions[ functionsLen++ ] = function() {};
glow.events.addListener("#yourForm", "submit", function() {
glow.net.post(
// make a request to the place the form posts to
this.action,
// get the data from the form to send to the server
glow.dom.get(this).val(),
{
onLoad: function(response) {
// response.text() is the response from the server
}
function trimFormField(selector, on) {
var field = glow.dom.get(selector);
return ["custom", {
on: on,
arg: function(values, opts, callback, formData) {
field.val( glow.lang.trim(values[0]) );
callback(glow.forms.PASS, "");
}
}];
}