Search Results

Search found 7 results on 1 pages for 'ryonlife'.

Page 1/1 | 1 

  • Using nested error wrappers with jQuery validate plugin

    - by RyOnLife
    I am using the jQuery validate plugin. My error labels are styled like tooltips and take many levels of nested divs in order to create. The plugin has a wrapper option that allows for an element type to be specified as a wrapper for the error message, but it's only wrapped once. Is anyone familiar with how to do nested wrapping? This isn't my exact markup, but as an example: <div class="tooltip"> <div> <div> <span class="error">This field is required.</span> </div> </div> </div> * UPDATE * The response from Chris answers my original question, but creates a new problem. The errors are now being displayed as desired, but the plugin fails to clear them. When a failed validation passes, span.error is set to display:none, but the div.tooltip nested wrapper still displays.

    Read the article

  • Most clever way to parse a Facebook OAuth 2 access token string

    - by RyOnLife
    It's a bit late, but I'm disappointed in myself for not coming up with something more elegant. Anyone have a better way to do this... When you pass an OAuth code to Facebook, it response with a query string containing access_token and expires values. access_token=121843224510409|2.V_ei_d_rbJt5iS9Jfjk8_A__.3600.1273741200-569255561|TxQrqFKhiXm40VXVE1OBUtZc3Ks.&expires=4554 Although if you request permission for offline access, there's no expires and the string looks like this: access_token=121843224510409|2.V_ei_d_rbJt5iS9Jfjk8_A__.3600.1273741200-569255561|TxQrqFKhiXm40VXVE1OBUtZc3Ks. I attempted to write a regex that would suffice for either condition. No dice. So I ended up with some really ugly Ruby: s = s.split("=") @oauth = {} if s.length == 3 @oauth[:access_token] = s[1][0, s[1].length - 8] @oauth[:expires] = s[2] else @oauth[:access_token] = s[1] end I know there must be a better way!

    Read the article

  • How to get this.grandparent() functionality in Mootools?

    - by RyOnLife
    I have built a class in Mootools and extended it twice, such that there is a grandparent, parent, and child relationship: var SomeClass1 = new Class({ initialize: function() { // Code }, doSomething: function() { // Code } }); var SomeClass2 = new Class({ Extends: SomeClass1, initialize: function() { this.parent(); }, doSomething: function() { this.parent(); // Some code I don't want to run from Class3 } }); var SomeClass3 = new Class({ Extends: SomeClass2, initialize: function() { this.parent(); }, doSomething: function() { this.grandParent(); } }); From Class3, the child, I need call the doSomething() method from Class1, the grandparent, without executing any code in Class2#doSomething(), the parent. What I need is a grandParent() method to complement the Mootools parent(), but it appears that one does not exist. What's the best way to accomplish this in either Mootools or pure JavaScript? Thanks.

    Read the article

  • How to debug when CakePHP Model::save() doesn't attempt an INSERT

    - by RyOnLife
    I am having a bear of a time saving the simplest record from a model called ItemView: if($this->save($this->data)) { echo 'worked'; } else { echo 'failed'; } Where $this-data is: Array ( [ItemView] => Array ( [list_id] => 1 [user_id] => 1 ) ) And my table is: CREATE TABLE IF NOT EXISTS `item_views` ( `id` int(11) NOT NULL auto_increment, `list_id` int(11) NOT NULL, `user_id` int(11) default NULL, `user_ip` int(10) unsigned default NULL, `created` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED AUTO_INCREMENT=1 ; Looking at the query dump in debug mode, Cake isn't even attempting an INSERT, so I have no idea how to debug. Any help would be appreciated.

    Read the article

  • jquery validation plugin - different treatment for display errors vs. clearing errors

    - by RyOnLife
    I am using the popular jQuery Validation Plugin. It's very flexible with regards to when validations are run (onsubmit, onfocusout, onkeyup, etc.). When validations do run, as appropriate, errors are both displayed and cleared. Without hacking the plugin core, I'd like a way to split the behavior so: Errors are only displayed onsubmit But if the user subsequently enters a valid response, errors are cleared onsubmit, onfocusout, etc. Just trying to create a better user experience: Only yell at them when they submit, yet still get the errors out of their face as soon as possible. When I ran through the options, I didn't see the callbacks necessary to accomplish this. I'd like to make it work without having to hack the plugin core. Anyone have some insights? Thanks.

    Read the article

  • Usage of initialize() vs. setup() in Mootools

    - by RyOnLife
    Mootools classes have an initialize() method that's called when a new object is instantiated. It seems that setup() is a commonly used method as well. Most classes I've observed call this.setup() from initialize() and nowhere else, which has left me wondering: What's the purpose of setup()? Why not just put the setup() code in initialize()? When does it make sense to use a setup() method?

    Read the article

  • referencing desired objects in namespaced functions

    - by RyOnLife
    I'm having trouble referencing the desired object when I've namespaced functions. No problems here: obj.test = function() { // this == obj } But I'm getting tripped up when I namespace: obj.namespace.test = function() { // this == namespace } In the latter example, I know this references namespace, but I want to reference obj. How can I do it?

    Read the article

1