Skip to content

Instantly share code, notes, and snippets.

@jjthrash
Created December 30, 2010 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjthrash/8c5eb2773b68aa22ed18 to your computer and use it in GitHub Desktop.
Save jjthrash/8c5eb2773b68aa22ed18 to your computer and use it in GitHub Desktop.
Provide hooks for a client (like UIWebView) to interact with
var PlatformIntegration = {
submitForm: function() {
var args = $A(arguments);
var selector = 'form';
if (args.size() > 0)
selector = args[0];
$$(selector)[0].submit();
},
setFormValue: function(field_id, value) {
$(field_id).setValue(value);
},
observe: function() {
$$('form').each(function(f) {
new Form.Observer(f, 0.3, function(form, value) {
window.location = 'platformintegration:formchanged';
});
});
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment