Flutter Dart: HTTP read does not retrieve full html from given URL - http
I am currently using http.read() in order to retrieve the raw html of a given URL. I use Safari's "Inspect Element" feature to compare the result.
I used this code and Google's webpage to test:
http.read("https://www.google.com/?client=safari").then((html) {
print(html);
});
The result printed was:
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="/5rKr18fNh5SdZTnYGW2ig==">(function(){window.google={kEI:'FPMcX_3_EYPbtQbD84wo',kEXPI:'0,202123,3,4,32,1151584,5663,731,223,179,3477,1449,206,3204,10,1226,364,926,573,817,383,246,5,1129,225,352,296,1046,1936,470,293,21,3,370,149,376,155,91,180,2,11,116,73,85,48,105,552,176,204,49,25,1120582,1197748,329519,13677,4855,32691,15248,867,6056,22628,9188,8384,4859,1361,9291,3025,4742,6,11027,1808,4020,978,7931,5297,2054,918,875,1217,2975,6430,1142,6290,7096,4517,1396,1381,920,2276,10,3681,706,1165,114,2213,529,149,1103,840,520,1134,278,51,56,157,4101,108,204,1135,1,3,2063,606,2023,1777,143,377,1947,2229,93,330,1282,16,2927,2247,1813,1786,3227,2845,7,6068,6286,4455,641,2450,2458,1226,1406,337,4928,108,1456,254,1697,908,2,3555,2397,7468,1,841,1337,666,432,3,1546,865,1,372,3545,706,149,189,1666,1646,2490,2251,5733,4,1528,17,358,1929,1236,271,874,405,1259,580,21,177,1918,192,179,745,973,9,43,75,4,135,1202,1425,459,117,758,6,438,24,14,198,601,1963,1503,293,1972,86,3,1493,877,910,1426,69,305,2310,1514,1009,288,939,4,3,807,91,599,1414,554,2,237,6,246,54,835,86,523,1556,44,465,107,81,102,219,194,4,644,268,67,175,35,212,75,689,431,30,210,250,9,439,1,133,131,95,793,5,2,149,1776,655,164,53,2,88,113,64,59,39,71,6,46,5,318,68,2,17,478,416,430,340,306,4,71,2,161,2,156,308,22,786,7,303,1,34,314,614,382,2021,665,2,4,362,5784360,1873,5998827,2801216,549,333,444,1,2,80,1,900,896,1,9,2,2551,1,748,141,59,736,563,1,4265,1,1,2,1017,9,305,3299,129,2,26,59,7,25,64,33,3502099,20458661',kBL:'aaAI'};google.sn='webhp';google.kHL='en';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var c;a&&(!a.getAttribute||!(c=a.getAttribute("eid")));)a=a.parentNode;return c||google.kEI};google.getLEI=function(a){for(var c=null;a&&(!a.getAttribute||!(c=a.getAttribute("leid")));)a=a.parentNode;return c};google.ml=function(){return null};google.time=function(){return Date.now()};google.log=function(a,c,b,d,g){if(b=google.logUrl(a,c,b,d,g)){a=new Image;var e=google.lc,f=google.li;e[f]=a;a.onerror=a.onload=a.onabort=function(){delete e[f]};google.vel&&google.vel.lu&&google.vel.lu(b);a.src=b;google.li=f+1}};google.logUrl=function(a,c,b,d,g){var e="",f=google.ls||"";b||-1!=c.search("&ei=")||(e="&ei="+google.getEI(d),-1==c.search("&lei=")&&(d=google.getLEI(d))&&(e+="&lei="+d));d="";!b&&google.cshid&&-1==c.search("&cshid=")&&"slh"!=a&&(d="&cshid="+google.cshid);b=b||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+c+e+f+"&zx="+google.time()+d;/^http:/i.test(b)&&"https:"==window.location.protocol&&(google.ml(Error("a"),!1,{src:b,glmm:1}),b="");return b};}).call(this);(function(){google.y={};google.x=function(a,b){if(a)var c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};}).call(this);google.f={};(function(){
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.target){var c=a.getAttribute("data-submitfalse");a="1"==c||"q"==c&&!a.elements.q.value?!0:!1}else a=!1;a&&(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&&a!=document.documentElement;a=a.parentElement)if("A"==a.tagName){a="1"==a.getAttribute("data-nohref");break a}a=!1}a&&b.preventDefault()},!0);}).call(this);
var a=window.location,b=a.href.indexOf("#");if(0<=b){var c=a.href.substring(b+1);/(^|&)q=/.test(c)&&-1==c.indexOf("#")&&a.replace("/search?"+c.replace(/(^|&)fp=[^&]*/g,"")+"&cad=h")};</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#36c}.q{color:#00c}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}body{background:#fff;color:#000}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}.lsbb{display:block}#fll a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}</style><script nonce="/5rKr18fNh5SdZTnYGW2ig=="></script></head><body bgcolor="#fff"><script nonce="/5rKr18fNh5SdZTnYGW2ig==">(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>Search</b> <a class=gb1 href="https://www.google.com/imghp?hl=en&tab=wi">Images</a> <a class=gb1 href="https://maps.google.com/maps?hl=en&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=en&tab=w8">Play</a> <a class=gb1 href="https://www.youtube.com/?gl=US&tab=w1">YouTube</a> <a class=gb1 href="https://news.google.com/nwshp?hl=en&tab=wn">News</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="https://www.google.com/intl/en/about/products?tab=wh"><u>More</u> »</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.com/history/optout?hl=en" class=gb4>Web History</a> | <a href="/preferences?hl=en" class=gb4>Settings</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=https://www.google.com/%3Fclient%3Dsafari" class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div><center><br clear="all" id="lgpd"><div id="lga"><img alt="Google" height="92" src="/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png" style="padding:28px 0 14px" width="272" id="hplogo"><br><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%"> </td><td align="center" nowrap=""><input name="client" value="safari" type="hidden"><input name="ie" value="ISO-8859-1" type="hidden"><input value="en" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden"><div class="ds" style="height:32px;margin:4px 0"><input class="lst" style="margin:0;padding:5px 8px 0 6px;vertical-align:top;color:#000" autocomplete="off" value="" title="Google Search" maxlength="2048" name="q" size="57"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Google Search" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" id="tsuid1" value="I'm Feeling Lucky" name="btnI" type="submit"><script nonce="/5rKr18fNh5SdZTnYGW2ig==">(function(){var id='tsuid1';document.getElementById(id).onclick = function(){if (this.form.q.value){this.checked = 1;if (this.form.iflsig)this.form.iflsig.disabled = false;}
else top.location='/doodles/';};})();</script><input value="AINFCbYAAAAAXx0BJCwQ1DaxEnFHF52CcFaC-EESwJcf" name="iflsig" type="hidden"></span></span></td><td class="fl sblc" align="left" nowrap="" width="25%">Advanced search</td></tr></table><input id="gbv" name="gbv" type="hidden" value="1"><script nonce="/5rKr18fNh5SdZTnYGW2ig==">(function(){var a,b="1";if(document&&document.getElementById)if("undefined"!=typeof XMLHttpRequest)b="2";else if("undefined"!=typeof ActiveXObject){var c,d,e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(c=0;d=e[c++];)try{new ActiveXObject(d),b="2"}catch(h){}}a=b;if("2"==a&&-1==location.search.indexOf("&gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&&(g.value=a);f&&window.setTimeout(function(){location.href=f},0)};}).call(this);</script></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br></div><span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="fll">Advertising ProgramsBusiness SolutionsAbout Google</div></div><p style="font-size:8pt;color:#767676">© 2020 - Privacy - Terms</p></span></center><script nonce="/5rKr18fNh5SdZTnYGW2ig==">(function(){window.google.cdo={height:0,width:0};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b){var c=window.document,d="CSS1Compat"==c.compatMode?c.documentElement:c.body;a=d.clientWidth;b=d.clientHeight}a&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log("","","/client_204?&atyp=i&biw="+a+"&bih="+b+"&ei="+google.kEI);}).call(this);})();(function(){var u='/xjs/_/js/k\x3dxjs.hp.en_US.v1Yj6_3_xDY.O/m\x3dsb_he,d/am\x3dAE-wOQ/d\x3d1/rs\x3dACT90oHxuZHmSFByKKKhO9lKfARcvsOJJg';
setTimeout(function(){var b=document;var a="SCRIPT";"application/xhtml+xml"===b.contentType&&(a=a.toLowerCase());a=b.createElement(a);a.src=u;google.timers&&google.timers.load&&google.tick&&google.tick("load","xjsls");document.body.appendChild(a)},0);})();(function(){window.google.xjsu='/xjs/_/js/k\x3dxjs.hp.en_US.v1Yj6_3_xDY.O/m\x3dsb_he,d/am\x3dAE-wOQ/d\x3d1/rs\x3dACT90oHxuZHmSFByKKKhO9lKfARcvsOJJg';})();function _DumpException(e){throw e;}
function _F_installCss(c){}
(function(){google.jl={dw:false,em:[],emw:false,lls:'default',pdt:0,snet:true,uwp:true};})();(function(){var pmc='{\x22d\x22:{},\x22sb_he\x22:{\x22agen\x22:true,\x22cgen\x22:true,\x22client\x22:\x22heirloom-hp\x22,\x22dh\x22:true,\x22dhqt\x22:true,\x22ds\x22:\x22\x22,\x22ffql\x22:\x22en\x22,\x22fl\x22:true,\x22host\x22:\x22google.com\x22,\x22isbh\x22:28,\x22jsonp\x22:true,\x22msgs\x22:{\x22cibl\x22:\x22Clear Search\x22,\x22dym\x22:\x22Did you mean:\x22,\x22lcky\x22:\x22I\\u0026#39;m Feeling Lucky\x22,\x22lml\x22:\x22Learn more\x22,\x22oskt\x22:\x22Input tools\x22,\x22psrc\x22:\x22This search was removed from your \\u003Ca href\x3d\\\x22/history\\\x22\\u003EWeb History\\u003C/a\\u003E\x22,\x22psrl\x22:\x22Remove\x22,\x22sbit\x22:\x22Search by image\x22,\x22srch\x22:\x22Google Search\x22},\x22ovr\x22:{},\x22pq\x22:\x22\x22,\x22refpd\x22:true,\x22rfs\x22:[],\x22sbpl\x22:16,\x22sbpr\x22:16,\x22scd\x22:10,\x22stok\x22:\x22JbTioW75SpWion0I9cXOm7-NBDI\x22,\x22uhde\x22:false}}';google.pmc=JSON.parse(pmc);})();</script> </body></html>
There is a lot missing here. These are a few examples that are found in the "Inspect Element" page but not in the result of the http.read() call:
HTML for "How Search Works":
<a class="Fx4vi" href="https://google.com/search/howsearchworks/?fg=1"> How Search works </a>
HTML for "About":
About
There are also some other details missing from the HTTP read call. Why does it not return all of the raw HTML?
Related
In JAWS and chrome placeholder contains city,state,country but in Jaws it is reading as city\state\country
Here is my code for that can anyone please help me on this <div class="location has-feedback ph-a11y-location" data-ph-at-id="location" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-MYIYtj"> <label for="hasfeature-location" id="hasFeature-search-location-label" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-y9rfkd"> <ppc-content key="HdNSNY-qkzjzs-ph-event-search-v1-default-searchLocationText" data-ph-at-id="label-text" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-DFwDbG"> Search location </ppc-content> </label> <!-- autocomplete="location" --> <input type="text" ref="locationbox" ph-a11y-autocomplete="is-show-results-on-focus.bind: !isNewEventLocationSearch" name="location" aria-controls="loc-listbox" value.bind="formData['location'].value" id="hasfeature-location" aria-owns="loc-listbox" aria-haspopup="listbox" class="form-control location ph-a11y-location-box au-target" placeholder="City,State,Country" key-placeholder="aQgj4W-qkzjzs-ph-event-search-v1-default-locationsearchboxplaceholderText" data-ph-at-id="input" aria-labelledby="hasFeature-search-location-label" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-7ChQ5X" au-target-id="49" aria-activedescendant=""> <span aria-hidden="true" show.bind="!formData['location'].value" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-0TiVEf" class="au-target icon icon-map-pin form-control-feedback location-icon" au-target-id="50"></span> <button aria-label="Clear text" type="button" key-aria-label="RHJ2eO-qkzjzs-ph-event-search-v1-default-clearLocationText" class="form-control-feedback phs-keysearch-clear location-clear-icon au-target aurelia-hide" data-ph-at-id="clear-eventsearch-link" click.delegate="clearFieldValue('location', locationbox)" show.bind="formData['location'].value" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-LLyYrP" au-target-id="51"> <i class="icon icon-cancel" aria-hidden="true" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-ln6ufj"></i> <span class="sr-only" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-hKDCAz"> <ppc-content key="SivoXp-qkzjzs-ph-event-search-v1-default-locationMenuOpenClearText" data-ph-at-id="clear-eventsearch-text" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-ELD0zf"> location clear text </ppc-content> </span> </button> <ul class="on-focus location phs-location-suggested-list au-target aurelia-hide" id="loc-listbox" aria-labelledby="loc-listbox" aria-label="locations" role="listbox" tabindex="-1" show.bind="fieldData.location.showListbox" data-ph-at-id="suggested-data-list" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-THexzy" au-target-id="52" data-ol-has-click-handler="" aria-expanded="false"> <!--anchor--> <li ref="facetRef" data-ph-at-id="no-data" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-DzgLbR" class="au-target" au-target-id="56"> <div class="no-facet-results" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-bf6eoG"> <span data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-RRGnuz"> <ppc-content key="wApLmD-qkzjzs-ph-event-search-v1-default-noLocationResultsFound" data-ph-at-id="no-data-text" data-ph-id="ph-default-1648705629687-ph-event-search-v1qkzjzs-g9TfpZ"> No results found </ppc-content> </span> </div> </li><!--anchor--> </ul> </div> Not sure why Jaws announcing back slash and it is happening in palceholder text
I think this is a bug in JAWS where JAWS might be double-escaping your comma characters in the <input> placeholder text when there is an aria-labelledby or aria-label associated with the <input>. So, instead of reading it as "City,State,Country" it instead escapes the commas twice and reads it as "City\,State\,Country". I recommend that you remove the commas in your placeholder text to avoid the JAWS error. An alternative would be to put the placeholder text outside of the <input> (such as below the input field as help text) and associate it using the aria-describedby attribute. For example: <label for="location" id="search-location-label">Search location</label> <input type="text" name="location" id="location" aria-labelledby="search-location-label" aria-describedby="location-helptext"> <span id="location-helptext">City, State, Country</span>
How to create a list with actions using materialize-css?
I'm trying to create a list with checkboxes for collecting actions with materialize, but the input tag didn't get recognized by the pattern. Is this possible? <div class="row"> <ul class="collection with-header" v-if="listaRoles.length > 0"> <li class="collection-header left-align"><h4> Roles do perfil {{ perfil.descricao }}</h4></li> <li v-for="r in listaRoles" :key="r.id" class="collection-item"> <div class="left-align"> <span> {{ r.descricao }} </span> <input type="checkbox" /> </div> </li> </ul> </div>
You have to use the exact same structure as the materialize docs, otherwise your components won't work correctly. So in the case of checkboxes that is <input>, followed by <span>, and both of these wrapped in a <label>. <label> <input type="checkbox" /> <span>Red</span> </label> Any deviation from this will break the component. EDIT: Checkboxes inside li works perfectly fine, here a codepen to demonstrate: https://codepen.io/doughballs/pen/KKpNrPy The error is coming from somewhere else. https://materializecss.com/checkboxes.html
Getting the value from a button text for thyme leaf
Ok, I have this somewhat complex piece of HTML that I have to integrate with. It is a button with a drop down (using aria) and I had to pass in a currency list and be able to select one of the dropdown elements (currency values) and update the button text with the selected value. I write a tiny bit of js and that works well. I use thymeleaf to pass in values to populate and that works well. I also need to read the values that were set from the post to the spring mvc controller but I always get a empty string for the value that I set via js. here is the javascript $(".currencyDropdown li a").click(function () { var selText = $(this).text().trim(); var button = $("#currencyButton"); button.text(selText); console.log("currency selected is:" + selText); }); here is the html <div class="col-sm-9 col-sm-offset-3 col-xs-12 form-row"> <div class="dropdown"> <button class="btn btn-default dropdown-toggle field-small" type="button" id="currencyButton" name="currencyButton" th:field="${pals.selectedCurrency}" data-toggle="dropdown" th:inline="text"> [[${pals.selectedCurrency}]] <i class="fa fa-caret-down"></i> </button> <ul id="currencyDropdown" class="dropdown-menu currencyDropdown" role="menu" aria-labelledby="currencyButton"> <li role="presentation" th:each="currency:${pals.currencyList}"> <a role="menuitem" tabindex="-1" href="#" th:inline="text"> [[${currency}]] </a> </li> </ul> </div> What I am trying to read back in the spring mvc controller is the pals.selectedCurrency value and it is always empty. Something I am missing? I was playing around and tried setting value and field. In reality I want to read the inline text that my js inserts.
I think you must add a th:fragment on you button and change the text of the button via ajax from backing bean from server, not from javascript. It's something like this : <form th:action="#{/PersonEdit/save(contract=${param.contract})}" th:object="${personBean}" method="POST" th:if="${param.contract != null}"> ... other form components <div class="form-group"> <label class="col-sm-4 control-label" th:text="#{person.edit.policy.tfoms}"></label> <div class="col-sm-8"> <select class="form-control" th:field="*{tfoms}" onchange="loadInsuranceCompanies()"> <option th:each="t : ${tfomses}" th:value="${t.uidtfoms}" th:text="${t.shortName}" th:selected="${personBean.tfoms != null and personBean.tfoms.equals(t)}"></option> </select> </div> </div> <div th:class="${#fields.hasErrors('insuranceCompany')} ? 'form-group has-error' : 'form-group'"> <label class="col-sm-4 control-label" th:text="#{person.edit.policy.ic}"></label> <div class="col-sm-8" id="insuranceCompaniesContent"> <select class="form-control" id="insuranceCompany" name="insuranceCompany" th:fragment="insuranceCompany"> <option th:each="i : ${insuranceCompanies}" th:value="${i.uidinsurancecompany}" th:text="${i.shortName}" th:selected="${personBean.insuranceCompany != null and personBean.insuranceCompany.equals(i)}"></option> </select> <div th:if="${#fields.hasErrors('insuranceCompany')}" th:each="err : ${#fields.errors('insuranceCompany')}"> <span class="text-danger" th:text="${err}"></span><br/> </div> </div> </div> In my case I refreshing one dropdown via another.Then refresh this fragment via ajax on item selection function loadInsuranceCompanies() { var url = [[#{/PersonEdit/insuranceCompanies}]]; if ($('#tfoms').val() !== '') { url = url + '/' + $('#tfoms').val(); } $("#insuranceCompaniesContent").load(url); } I think the trouble can be because you using not a standard select as a dropdown.
Ok, I figured out a relatively simple answer to it. I have to use the html that was provided because of look and feel considerations from the customer. so what I did was add a hidden input and set that from the java script. $(".currencyDropdown li a").click(function () { var selText = $(this).text().trim(); $("#currencyButton").text(selText); $("#currencySelected").val(selText); console.log("currency selected is:" + selText); }); <input type="hidden" id="currencySelected" th:field="${pals.selectedCurrency}"/> <button class="btn btn-default dropdown-toggle field-small" type="button" id="currencyButton" data-toggle="dropdown" th:inline="text"> [[${pals.selectedCurrency}]] <i class="fa fa-caret-down"></i> </button> <ul id="currencyDropdown" class="dropdown-menu currencyDropdown" role="menu" aria-labelledby="currencyButton"> <li role="presentation" th:each="currency:${pals.currencyList}"> <a role="menuitem" tabindex="-1" href="#" th:inline="text"> [[${currency}]] </a> </li> </ul> I see the correct values that were selected for my dropdown on the spring mvc controller and now I can get on with the rest of the stuff.
Create custom portelt - mixture of news and events
I'm trying to create a custom portelt which displays news or event items based on a keyword. I don't want to use the collects portlet facility. I've created a Python Script which fetches the necessary results like this: from Products.CMFCore.utils import getToolByName portal_catalog = getToolByName(context, 'portal_catalog') return portal_catalog.searchResults( Subject = 'Startseite', end={'query': DateTime(), 'range': 'min'}, sort_on='start', sort_limit=3, review_state='external')[:5] So this should fetch all objects with the review_state 'external' and the keyword (or subject) 'Startseite'. Now I've created a page template which is used to render a classic portelt: <html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal" i18n:domain="plone"> <body> <div metal:define-macro="portlet" tal:define="view context/##events_view; results context/startpage_informations; events_link view/all_events_link; prev_events_link view/prev_events_link" tal:condition="results"> <dl class="portlet" id="portlet-events"> <dt class="portletHeader"> <span class="portletTopLeft"></span> <a href="" tal:attributes="href events_link" class="tile"> Wichtige Neuigkeiten: </a> <span class="portletTopRight"></span> </dt> <tal:events tal:repeat="obj results"> <dd class="portletItem" tal:define="oddrow repeat/obj/odd" tal:attributes="class python:test(oddrow, 'portletItem even', 'portletItem odd')"> <a href="#" class="tile" tal:attributes="href obj/getURL; title obj/Description"> <img src="#" alt="" tal:replace="structure here/news_icon.gif" /> <span tal:replace="obj/pretty_title_or_id"> Some Event </span> <span class="portletItemDetails" tal:define="starts python:toLocalizedTime(obj.start, long_format=1); ends python:toLocalizedTime(obj.end, long_format=1); startTime python:toLocalizedTime(obj.start,time_only=1); endTime python:toLocalizedTime(obj.end,time_only=1); startDay python:toLocalizedTime(obj.start, long_format=0); endDay python:toLocalizedTime(obj.end, long_format=0);"> <span> <tal:condition condition="obj/location"> <tal:location content="obj/location">Location</tal:location>,<br /> </tal:condition> <tal:sameday tal:condition="python:startDay==endDay"> <span tal:condition="startDay" tal:replace="startDay">:[If this is an event, show its start time and date]</span><br /> Uhrzeit: <span tal:condition="startTime" tal:replace="startTime">[If this is an event, show its start time and date]</span> - <span tal:condition="endTime" tal:replace="endTime">[If this is an event, show its start time and date]</span> </tal:sameday> <tal:multiday tal:condition="python:startDay!=endDay"> Vom <span tal:condition="starts" tal:replace="starts">[If this is a multi-day event, show its start date]</span><br />bis <tal:hasendday tal:condition="ends"> <span tal:replace="ends">[If this is a multi-day event, show its end date]</span> </tal:hasendday> </tal:multiday> </span> </span> </a> </dd> </tal:events> </dl> </div> </body> </html>
Video rich snippet: when to use <span> and when <meta>?
I see all kinds of examples of video rich snippet code. What I don't understand is that sometimes people use tags and sometimes tags to markup the same thing. Is there some kind of rule or meaning? Is the outcome different depending on what I use? Thanks!
Take below for example. Say I want to include metadata for items that are not rendered to the viewer. Such as tue-thur of the opening hours they go into meta tags. Notice that they are still wrapped in the parent span as the tags for mon and fri which are rendered to the viewer. This makes all five days into one item. These and the geo cords tags near the bottom are easy examples to try out in Google's Rich Snippet Tool to see the differences in the way the tags are interpreted depending on the way they are nested. <span itemprop="hasPOS"> <span itemprop="contactPoint" itemscope="" itemtype="http://schema.org/ContactPoint"> <i class="icon-phone blue"></i>303-948-2988 </span><br> <span itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"> <span itemprop="streetAddress">7921 S. Platte Canyon Rd</span><br> <span itemprop="addressLocality" itemscope="" itemtype="http://schema.org/City"> <span itemprop="name">Littleton,</span> </span> <span itemprop="addressRegion" itemscope="" itemtype="http://schema.org/State"> <span itemprop="name">Colorado</span> </span><br> <span itemprop="postalCode">80128</span> </span><br> <span itemprop="openingHours" itemscope="" itemtype="http://schema.org/OpeningHoursSpecification"> <span itemprop="dayOfWeek"> <span itemscope="" itemtype="http://schema.org/DayOfWeek/Monday">Monday</span> </span>- <span itemprop="dayOfWeek"> <span itemscope="" itemtype="http://schema.org/DayOfWeek/Friday">Friday</span> </span>7am - 6pm <meta itemprop="dayOfWeek" itemtype="http://schema.org/DayOfWeek/Tuesday" content="Tuesday" /> <meta itemprop="dayOfWeek" itemtype="http://schema.org/DayOfWeek/Wednesday" content="Wednesday" /> <meta itemprop="dayOfWeek" itemtype="http://schema.org/DayOfWeek/Thursday" content="Thursday" /> <meta itemprop="opens" itemtype="http://schema.org/Time" content="19:00:00Z-06:00" /> <meta itemprop="closes" itemtype="http://schema.org/Time" content="08:00:00Z-06:00" /> </span> <span itemprop="geo" itemscope="" itemtype="http://schema.org/GeoCoordinates"> <meta itemprop="latitude" content="39.572216" /> <meta itemprop="longitude" content="-105.056745" /> </span> </span>