跳至主要内容

博文

jquery how to hide the select arrow when the ajax return only one option

well, just note it for memo. html: less: /* Select arrow styling */ .address_city_chooser{ >div{ position:relative; display:inline-block; &.disabled{ label:after{ content: ''; width: 23px; height: 23px; position: absolute; display: inline-block; top: 4px; right: 4px; background: #fff; pointer-events: none; } } } } and js: $.get( Routing.generate('prospection_public_city',{'postCode':code,'_locale':currentLang}), function(response){ if(typeof response.error!="undefined"){ $('#errorDialog').html(response.error); $('#errorDialog').dialog('open'); }else{ $(container).html(response); if ($(container).find('option').length

jquery validation, how to check a select box is not the default value

1. You can write your own rule! // add the rule here $ . validator . addMethod ( "valueNotEquals" , function ( value , element , arg ){ return arg != value ; }, "Value must not equal arg." ); // configure your validation $ ( "form" ). validate ({ rules : { SelectName : { valueNotEquals : "default" } }, messages : { SelectName : { valueNotEquals : "Please select an item!" } } }); 2. An easier solution has been outlined here:  [jQuery] Validate select box Make the value be empty and add the required attribute id = "select" class = "required" > value = "" > Choose an option value = "option1" > Option1 value = "option2" > Option2 value = "option3" > Option3

css zoom a block

zoom : 145 %; - moz - transform : scale ( 1.45 ); - webkit - transform : scale ( 1.45 ); Zoom and transform scale are not the same thing. They are applied at different times. Zoom is applied before the rendering happens, transform - after. The result of this is if you take a div with width/height = 100% nested inside of another div, with fixed size, if you apply zoom, everything inside your inner zoom will shrink, or grow, but if you apply transform your entire inner div will shrink (even though width/height is set to 100%, they are not going to be 100% after transformation). In my opinion, i think we should use zomm not transform, transform is just resize the element.

rsync exclude some folder or file

example: rsync -avt /home/workspace/symfony2.1_bannieres /home/local_workspace/admin --delete --exclude-from '/home/local_workspace/exclude_admin.txt' suppose we have a exclude file in /home/local_workspace/exclude_admin.txt, and his content is : app/logs app/cache .svn .git this is the article: http://articles.slicehost.com/2007/10/10/rsync-exclude-files-and-folders

css rewrite , concerned with less and yui

I have a problem really odd about css rewrite. suppose we have a css in AcmeTestBundle/Resources/public/css folder, named a.less. In this a.css we have a rule like: background: url(../images/buttons.png) no-repeat top left; which is the AcmeTestBundle/Resources/public/images/button.png, for some ugly reasons, if we use symfony2 assetic, the cssrewrite can not translate it correctly, so we use this commmand first ; php app/console assets:install and then in our layout.twig, we can use this: {% stylesheets 'bundles/acmetest/css/*.less' filter='lessphp,cssrewrite,?yui_css' output='css/test.css' %} {% endstylesheets %} well, the odd thing come, we get a web/css/test.css, and in this file, we have a image link like this: background: url((../../bundles/acmetest/images/buttons.png) no-repeat top left; if your site url is the root of the domain, no problem, like you have a domain name : www.abcefg.com. But,...

symfony2 PHP Warning: SessionHandler::close(): Parent session handler is not open when logout

this is an error introduced by php version under 4.11, https://groups.google.com/forum/#!topic/symfony-devs/Q-f0lKT7OZ8 and https://github.com/symfony/symfony/issues/5868 are the bug report, the solution for no way to upgrade  php is : logout: path: fos_user_security_logout target: / invalidate_session: false