Search Results

Search found 12 results on 1 pages for 'snaken'.

Page 1/1 | 1 

  • Observing events on injected elements using prototype

    - by snaken
    I asked a question previously, it was answered correctly in the form i asked it but realised now why it wasnt working for me. i have this code to observe multiple select menus: $('product_options').select('select').invoke("observe","change",optchange); This does work - as pointed out - with static layout like this: <html> <head> <title>optchange</title> <script type="text/javascript" src="prototype.js"></script> </head> <body> <div id="product_options"> <select id="o0"> <option>1</option> <option>2</option> </select> <select id="o1"> <option>1</option> <option>2</option> </select> <select id="o3"> <option>1</option> <option>2</option> </select> </div> <script type="text/javascript"> function optchange(e) { alert("optchanged"); } $('product_options').select('select').invoke("observe","change", optchange); </script> </body> </html> But in my context, making a selection in the first select menu fires of an Ajax.Updater that completely replaces the content of Select 2 - this is killing the event observer. Is there a way to fix this without having to apply a new event observer each time? Thanks.

    Read the article

  • Handling one-to-many relationship with ZF partialLoop

    - by snaken
    Lets say i'm listing musical artists, each artist has basic information like Name, Age etc. stored in an artist table. They also have entries in an Albums table (album name/album cover etc), referencing the artist table using the artist id as a foreign key. I have the Model_Artist (Artist.php) file: class Model_Artist extends Zend_Db_Table_Abstract { protected $_name = 'artist'; protected $_dependentTables = array('Model_ArtistAlbums'); public function fetchArtistss() { $select = $this->select(); return $this->fetchAll($select); } } and to the Model_ArtistAlbums (ArtistAlbums.php) file class Model_ArtistAlbums extends Zend_Db_Table_Abstract { protected $_name = 'albums'; protected $_referenceMap = array( 'Artists' => array( 'columns' => 'alb_art_id', 'refTableClass' => 'Model_Artist', 'refColumns' => 'art_id' ) ); // etc } in my controller: public function indexAction() { /* THIS WORKS $art = new Model_Artist(); $artRowset = $art->find(1); $art1 = $artRowset->current(); $artalbums = $art1->findDependentRowset('Model_ArtistAlbums'); foreach($artalbums as $album){ echo $album->alb_title."<br>"; } */ $arts = new Model_Artist(); $this->view->artists = $arts->fetchArtists(); } in the view file: $this->partial()->setObjectKey('artist'); echo $this->partialLoop('admin/list-artists.phtml', $this->artists); but with this code in artists/list-artists.phtml: foreach($this->artist->findDependentRowset('albums') as $album): // other stuff endforeach; i get this error: Fatal error: Call to a member function findDependentRowset() on a non-object A var_dump of $this->artist = NULL.

    Read the article

  • CSS selector for grouped iterations

    - by snaken
    Hi, I have a number of elements that i want to loop through as groups. Consider this HTML: <input class="matching match-1" /> <input class="matching match-1" /> <input class="matching match-2" /> <input class="matching match-2" /> <input class="matching match-2" /> <input class="matching match-3" /> <input class="matching match-3" /> // etc I want a CSS selector that would allow me to loop through these as groups so there would be - using this example - 3 iterations of the loop (one for match-1, one for match-2 and one for match-3). The 1,2,3 etc is a variable used for grouping but this is not fixed so it cannot rely on hard coding of these values. Is this even possible? I'll be using jQuery or prototype not that that should matter really. Thanks

    Read the article

  • CSS selector for the last occurrence of a class on a page

    - by snaken
    Is there a CSS selector for the last occurrence of a class on a page? Say i have this HTML <dd> <span> <a class="required" id="forename">foo</a> </span> </dd> <dd> <span> <a class="required" id="surname">bar</a> </span> </dd> Is there a CSS selector that would return the a tag with the ID of surname. Something like .required:last maybe? Will be using Prototype if that matters?

    Read the article

  • Create MySQL user and database from PHP

    - by snaken
    Hi, Is there a way to create a new MySQL database, a new MySQL user and give the new user priviledges on the new database all using PHP? I've seen examples where mysql_query is used like this: mysql_query("CREATE DATABASE ".$dbname)or die(mysql_error()); but i don't see how this would work as there's no database connection. Help please!

    Read the article

  • XSS exploit when JavaScript is disabled

    - by snaken
    I'm getting pretty frustrated trying to make McAffee whitelist a supposed exploit on a site i work on. The issue is that their automated system has detected a supposed XSS exploit but the exploit only exists when JavaScript is disabled. Given the fact that you need JavaScript to be disabled for the exploit to exist then surely this means this is not an exploit. Can anyone think of any possible arguments to the contrary? Update - To add more detail: The problem comes from in one place unsanitized URL content is written to an anchor tag href.So, with JS disabled you could have something like this: <a href="foor.php?"><script>alert('foo')</script>#someanchor" .. When JavaScript is enabled this href is updated to be this (on dom ready): <a href="javascript:;">link</a> So, with JS enabled the link is no longer injected, with JS disabled the alert would no longer execute.

    Read the article

  • Create database in Shell Script - convert from PHP

    - by snaken
    I have the following PHP code that i use to create a databaase and grant permissions to a user: $con = mysql_connect("IP.ADDRESS","user","pass"); mysql_query("CREATE DATABASE ".$dbuser."",$con)or die(mysql_error()); mysql_query("grant all on ".$dbuser.".* to ".$dbname." identified by '".$dbpass."'",$con) or die(mysql_error()); I want to perform these same actions but from within a shell script. Is it just something like this: MyUSER="user" MyPASS="pass" MYSQL -u $MyUSER -h -p$MyPASS -Bse "CREATE DATABASE $dbuser;' MYSQL -u $MyUSER -h -p$MyPASS -Bse "GRANT ALL ON ${DBUSER}.* to $DBNAME identified by $DBPASS;"

    Read the article

  • Accessing variable from ARGV

    - by snaken
    I'm writing a cPanel postwwwact script, if you're not familiar with the script its run after a new account is created. it relies on the user account variable being passed to the script which i then use for various things (creating databases etc). However, I can't seem to find the right way to access the variable i want. I'm not that good with shell scripts so i'd appreciate some advice. I had read somewhere that the value i wanted would be included in $ARGV{'user'} but this simply gives "root" as opposed to the value i need. I've tried looping through all the arguments (list of arguments here) like this: #!/bin/sh for var do touch /root/testvars/$var done and the value i want is in there, i'm just not sure how to accurately target it. There's info here on doing this with PHP or Perl but i have to do this as a shell script. EDIT Ideally i would like to be able to call the variable by something other than $1 or $2 etc as this would create issues if an argument is added or removed Any ideas?

    Read the article

  • MySQL join problem

    - by snaken
    Whats wrong with this SQL? It should return results but returns nothing SELECT `pid` FROM `products` LEFT JOIN `prods_to_features` ON (`ptf_pid` = `pid`) WHERE (`ptf_id` = '66' OR `ptf_id` = '67') AND (`ptf_id` = '76') Is it not possible to have the 2nd where clause for the table that has been used in the left join?

    Read the article

  • observing multiple select menus with prototype

    - by snaken
    Hi, I want to observe multiple select menus and respond to their changes using prototype but only the first menu seems to be observed. This is my code: $('product_options').select('select').invoke("observe","change",optchange); If there are - for example - 3 selects within product_options then it only observes the first, i thought it might be because of invoke so i then tried this: $('product_options').select('select').each(function(sel){ $(sel).observe("change",optchange); }); Still doesnt work though, any ideas whats wrong?

    Read the article

  • Random password variable disappears

    - by snaken
    Hi, I'm using the following to generate a random password in a shell script: DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) When i run this in a file on its own like this: #!/bin/sh DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) echo $DBPASS A password is echoed. When i incorporate it into a larger script though the variable never seems to get created for some reason, so for example this doesn't work: DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) sed -i s/oldpass/$DBPASS/ mysql_connect.php If i manually set the variable though everything is fine.. can anyone see why?

    Read the article

  • check all values match using prototype

    - by snaken
    Using prototype, is there a simple method of checking that a group of values match, for example - can this code be refined to a single line or something otherwise more elegant? var val = ''; var fail = false; $('form').select('.class').each(function(e){ if(!val){ val = $F(e); }else{ if(val != $F(e)) fail = true; } });

    Read the article

1