Posts

jquery - ASP.NET CheckBoxFor generates hidden field messes up ajax submit -

so default @html.checkboxfor going generate hidden field after original field, like <input name="xxx" id="xxx" type="checkbox" .... data-val="true" value="true"/> <input name="xxx" type="hidden" value="false"/> when ajax submit $(form).serialize() post body contain 2 xxx fields if checkbox checked. ( xxx=true&&xxx=false ) expected. modelstate.isvalid returns false , error system.invalidoperationexception: parameter conversion type 'system.collections.generic.list`1[system.string]' type 'system.boolean' failed because no type converter can convert between these types how can fix this?? update: happening webapi controller, doing regular model binding [httppost] public void mymethod(mymodel model) { if ( !modelstate.isvalid ) throw new httpresponseexception( httpstatuscode.badrequest ); }

c++ create, assign and compare a new variable to two object inside an Operator Overloaded function. -

the assignment: implement alien class using provided alien.h file. alien, in scenario described in terms of his/her height, weight, , gender. compare 2 aliens, use following equation determine alien’s statuspoints value: statuspoints = weight * height * gendervalue gendervalue 2 if alien male, , 3 if alien female. status points should calculated when needed, not kept data member. avoids so-called stale data, in 1 data member, such weight might change , status points variable wouldn’t updated. status should used when comparing aliens. need overload ==, !=, >, <, >=, , <= operators compare aliens. thus, might have statements such following: if(alien1 > alien2) { //do } obviously, alien1 alien object, , alien2. assumed have data members (height, weight, , gender) initialized. here provided .h file. again, cannot alter file provided me. #ifndef alien_h #define alien_h class alien { public: alien(); alien(int h, in...

android - Libgdx Scene2d Image from NinePatchDrawable doesn't rotate -

i creating image using ninepatchdrawable , trying rotate using rotateby method simply, not rotating somehow. using following code snippet: textureatlas ninepatchatlas = game.getassetsinterface().gettextureatlas(constants.game_atlas); atlasregion region = ninepatchatlas.findregion("drawpatch"); ninepatch ninepatch = new ninepatch(region, 59, 59, 59, 59); ninepatchdrawable ninepatchdrawable = new ninepatchdrawable(ninepatch); image image = new image(ninepatchdrawable); image.setorigin(image.getwidth() / 2, image.getheight() / 2); image.setposition(200, 400); image.setwidth(150); image.rotateby(45); rotate working if use drawable instead of ninepatchdrawable on constructor of image. there facing same issue? after investigating have decided use containers follows: textureatlas ninepatchatlas = game.getassetsinterface().gettextureatlas(constants.game_atlas); atlasregion region = ninepatchatlas.findregion("drawpatch"); ninepatch ninepatch = new ninepatc...

regex - Javascript - modify regexp constructor or add tokens -

i need parse input against complex regexp's have common elements. i make "my text 2014".match(/{date}/); where date long regexp or set of tokens like regexp.tokens.date = /{year}|{month}|{day}/ etc. and uses tokens regexp.tokens.year = /** native regexp matching year number **/ i want {tokens} (recursively) parsed native regexp before testing. in other words - want add list of tokens , meaning , able make regexp using them. i trying modify constructor of regexp dont make change. rather hacking around existing stuff, should create own wrappers . something like: function myregex(src,flags) { for( var k in myregex.tokens) if( myregex.tokens.hasownproperty(k)) { src = src.replace(new regexp("\\{"+k+"\\}","g"),myregex.tokens[k]); } this.pattern = new regexp(src,flags); }; myregex.tokens = { "year": "your regex string here", // ... }; myregex.prototype.test = functi...

jquery - Multiple Google Maps within Bootstrap Tabs -

i have bootstrap tab structure single google map iframe inside each tab. first tab's iframe looks fine other ones unzoomed , uncentered. it's not iframe src code because tried replacing first 1 second , others; first 1 works fine. i have seen solutions none of them worked me; don't generate maps javascript (i thought bit complicated 'coz there 11 tabs, meaning 11 maps triggered separately js). how can make them first one? <ul id="tablist" class="nav mt20" role="tablist"> <li role="presentation" class="active"> <a href="#location1" aria-controls="location1" role="tab" data-toggle="tab">edİrne</a> </li> <li role="presentation"> <a href="#location2" aria-controls="location2" role="tab" data-...

php - Symfony2 Assetic not working with multiple javascript file with the * sign -

i use symfony2 , assetic bundle. (probleme when using * sign ask assetic take files) form have read here , there assetic allow use multiple javascript file. this work fine when when write file right before <'/html> tag: {% javascripts '@mysiteblogbundle/resources/public/js/test1.js' '@mysiteblogbundle/resources/public/js/test2.js' '@mysiteblogbundle/resources/public/js/test3.js' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} but same code, doesn't work if instead of listing file, use * (just this:) {% javascripts '@mysiteblogbundle/resources/public/js/*' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} with *, works depending on pages displayed. did javascipt test on class on main twig template. , thoses class displayed on pages... test should working. ...

javascript - Grab html element value -

how can grab html element value using php or javascript? tried using jquery dom ready event, problem value wanna grab dynamically loaded somewhere, , when use jquery dom ready event of times happens dom ready value of element empty (its still not loaded) , when grab value jquery gives empty value of element, because grabbing before loaded in element. how can grab value after loaded? there kind of trigger or event? any / ideas appreciated ! the accepted solution works, think better : <script type="text/javascript"> var bool = false; jquery('.element').bind('domnodeinserted', function() { if(bool == false) { alert("dom node inserted !"); bool = true; } }); </script> try using window.load below: $( window ).load(function() { // run code }); this guarantee page loaded first further comment. can't assign load event single element that. need wait elements loaded(whole page) if want...