|
POST
|
glad to help, please mark the thread as answered by checking the checkmark in the appropriate post, and also hit the up arrow on any post you deemed helpful so that others can see the answer as well
... View more
04-10-2014
08:30 AM
|
0
|
0
|
783
|
|
POST
|
option #1 (with the parser), you will need to fix the styling <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Query State Info without Map</title>
<script src="http://js.arcgis.com/3.9/"></script>
<script>
require([
"esri/tasks/query", "esri/tasks/QueryTask","dijit/registry",
"dojo/dom", "dojo/on", "dojo/parser","dojo/domReady!"
], function (Query, QueryTask,registry, dom, on, parser) {
parser.parse();
var queryTask = new QueryTask("secure");
var query = new Query();
query.returnGeometry = false;
query.outFields = [
"*"
];
on(dom.byId("execute"), "click", execute);
function execute () {
console.log("whooooaaaa");
var sel = dom.byId("input1").value;
console.log(sel);
var optionValue= registry.byId("selectfield");
console.log(optionValue);
query.where = optionValue + "LIKE '%" + sel +"%'";
queryTask.execute(query, showResults);
}
function showResults (results) {
var resultItems = [];
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features.attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
}
dom.byId("info").innerHTML = resultItems.join("");
dom.byId("info1").innerHTML = resultCount;
}
});
</script>
</head>
<body>
<select data-dojo-type="dijit/form/Select" class="field" name="selectfield" id="selectfield">
<option value="FIRSTNAME">First Name</option>
<option value="LAST_NAME">Last Name</option>
<option value="Service_ID">Service ID</option>
<option value="TOWNSHIP">Township</option>
</select>
Total records:
<span id="info1">0</span>
Total records:
US state name :
<input type="text" id="input1" value="California">
<input id="execute" type="button" value="Get Details">
<br />
<br />
<div id="info" style="padding:5px; margin:5px; background-color:#eee;">
</div>
</body>
</html>
... View more
04-09-2014
12:53 PM
|
0
|
0
|
2502
|
|
POST
|
ok there is two options if you want to use the dijit, you have to use the parser and call parser.parse() to make the dijits. This will allow you to use the registry. the other option is to go back to what you had and just to get the value from the select I would advise option 1 because it will be more useful in the long run, but will be more work. However, the easy answer (option2) <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Query State Info without Map</title> <script src="http://js.arcgis.com/3.8/"></script> <script> require([ "esri/tasks/query", "esri/tasks/QueryTask","dijit/registry", "dojo/dom", "dojo/on", "dojo/domReady!" ], function (Query, QueryTask,registry, dom, on) { var queryTask = new QueryTask("secure"); var query = new Query(); query.returnGeometry = false; query.outFields = [ "*" ]; on(dom.byId("execute"), "click", execute); function execute () { console.log("whooooaaaa"); var sel = dom.byId("input1").value; console.log(sel); var option= dom.byId("selectfield"); var optionValue = option.options[option.selectedIndex].value; console.log(optionValue); query.where = optionValue + "LIKE '%" + sel +"%'"; queryTask.execute(query, showResults); } function showResults (results) { var resultItems = []; var resultCount = results.features.length; for (var i = 0; i < resultCount; i++) { var featureAttributes = results.features.attributes; for (var attr in featureAttributes) { resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>"); } resultItems.push("<br>"); } dom.byId("info").innerHTML = resultItems.join(""); dom.byId("info1").innerHTML = resultCount; } }); </script> </head> <body> <select data-dojo-type="dijit/form/Select" class="field" name="selectfield" id="selectfield"> <option value="FIRSTNAME">First Name</option> <option value="LAST_NAME">Last Name</option> <option value="Service_ID">Service ID</option> <option value="TOWNSHIP">Township</option> </select> Total records: <span id="info1">0</span> Total records: US state name : <input type="text" id="input1" value="California"> <input id="execute" type="button" value="Get Details"> <br /> <br /> <div id="info" style="padding:5px; margin:5px; background-color:#eee;"> </div> </body> </html>
... View more
04-09-2014
12:51 PM
|
0
|
0
|
2502
|
|
POST
|
try declaring the select as a dijit <select data-dojo-type="dijit/form/Select" class="field" name="field" id="selectfield">
... View more
04-09-2014
11:48 AM
|
0
|
0
|
2502
|
|
POST
|
from the error, it looks like you used registry.byID not registry.byId
... View more
04-09-2014
11:32 AM
|
0
|
0
|
2502
|
|
POST
|
var optionValue= registry.byId("selectfield").get('value'); 1. your select element is id'd "selectfield" 2. You need to use registry (not dom) since you want the value of the DIJIT, not the HTML ELEMENT see some more info here http://stackoverflow.com/questions/1850050/how-to-get-the-value-of-a-filteringselect-select-in-dojo notice that is legacy style (dijit.byId) and since you are using AMD you want to use registry.byId Second Part ESRI now uses standardized queries to make it database agnostic. Supported SQL queries are http://resources.arcgis.com/en/help/main/10.2/index.html#//015400000686000000 so your where clause should be something like query.where = optionValue + " LIKE '%" + sel +"%'"; this handles partials ( 'ea' would return team) but not mispellings. For that you would need a soundex on the field you are querying in the database, it could not be handled in the application without submitting excessive amounts of individual queries for each possibility.
... View more
04-09-2014
07:52 AM
|
0
|
0
|
2502
|
|
POST
|
awesome, the more development tools the better. off to figure out how to conditionally put a hostname contains intranet into the dojoconfig so it is only true internally and to anxiously check the download page for 3.9 😉
... View more
04-08-2014
11:28 AM
|
0
|
0
|
1871
|
|
POST
|
the code is posted as a zip file in the 4th post of this thread
... View more
04-03-2014
09:48 AM
|
0
|
0
|
1978
|
|
POST
|
Sorry, I don't do private messages. I prefer to use the forums so everyone can benefit. Was there something missing from the code I posted earlier?
... View more
04-03-2014
08:26 AM
|
0
|
0
|
4180
|
|
POST
|
you will have more luck looking at the AMD samples on the esri forums
... View more
03-31-2014
09:42 AM
|
0
|
0
|
1958
|
|
POST
|
your code is pointing (based on above) to sampleserver6.arcgisonline.com for the printing service, but your proxy only allows access to <serverUrl url="http://services.arcgisonline.com" matchAll="true"/>
... View more
03-31-2014
09:40 AM
|
0
|
0
|
1051
|
|
POST
|
I feel like you are skipping alot of steps, you can not just change a line of code and expect this to work. You need to download the proxy.php page, add it to your application at the same location as your index.html page, and configure the proxy to access the locations you want access to More information on configuring a proxy can be found at https://developers.arcgis.com/javascript/jshelp/ags_proxy.html specifically " Download the appropriate proxy for your platform from GitHub. Each proxy download includes installation instructions and information on any system requirements make sure you follow these instructions in order to setup and configure the proxy on your web server."
... View more
03-31-2014
08:30 AM
|
0
|
0
|
1051
|
|
POST
|
for a proxy at the same spot as the index.nthl, it should be esri.config.defaults.io.proxyUrl = 'proxy.jsp'; or esri.config.defaults.io.proxyUrl = 'proxy.php'; etc... based on which version you chose to use
... View more
03-31-2014
08:03 AM
|
0
|
0
|
2741
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-22-2014 08:35 AM | |
| 1 | 05-02-2012 04:56 AM | |
| 1 | 10-29-2021 07:40 AM | |
| 1 | 10-28-2021 05:26 AM | |
| 1 | 07-17-2012 08:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-01-2022
02:00 PM
|