Opened 16 years ago
Closed 15 years ago
#2142 closed defect (wontfix)
Error dojo manual - Using the Dojo ComboBox with JSON data [Fix included ...]
Reported by: | guest | Owned by: | criecke |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | Doc parser | Version: | 0.4.1 |
Keywords: | ComboBox, JSON | Cc: | |
Blocked By: | Blocking: |
Description
I (FlyHigh_) found an error at the dojo manual - Using the Dojo ComboBox? (http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book44/Book79) Errors: 1.) The last comma rsults an error, that have to be removed with rtrim 2.) Clicking the DropDown? Button at the ComboBox? don't show all results 3.) the example is case sensitive, i think that's not good
Thanks to slightlyoff, you realy helped me on irc. Thanks for dojo i don't understand it, but i love it. FlyHigh?
<?php $states = array( "Alabama" => "AL",
"Alaska" => "AK", ...
);
$userInput = $_GETmatch?; $result = "[";
foreach ($states as $state => $abbreviation) {
if (strpos($state, $userInput) === 0) {
$result = $result . '[ "' . $state . '", "' .
$abbreviation . '"],';
}
}
$result = $result . ']'; print $result; ?>
<?php $states = array( "Alabama" => "AL",
"Alaska" => "AK", "American Samoa" => "AS", "Arizona" => "AZ", "Arkansas" => "AR", "Armed Forces Europe" => "AE", "Armed Forces Pacific" => "AP", "Armed Forces the Americas" => "AA", "California" => "CA"
);
$userInput = $_GETmatch?; $result = "[" ;
Durchsuche ob String am Anfang gefunden wird, unberücksichtigt der Groß- Klein Schreibung (stripos); Soll die Groß klein Schreibung berücksichtigt werden strpos
foreach ($states as $state => $abbreviation) {
if (stripos($state, $userInput) === 0) {
$result = $result . '[ "' . $state . '", "' .
$abbreviation . '"],';
}
}
Show all data if nothing is submittet, or drop down button is pressed if (strlen($userInput) == 0) {
foreach ($states as $state => $abbreviation) {
$result = $result . '[ "' . $state . '", "' .
$abbreviation . '"],';
}
}
Remove the last comma $result = rtrim($result, ",") . ']'; print $result; ?>
Change History (4)
comment:1 Changed 16 years ago by
Milestone: | → 0.5 |
---|---|
Owner: | changed from Neil Roberts to bill |
Status: | new → assigned |
comment:2 Changed 15 years ago by
Milestone: | 0.9 → 1.0 |
---|---|
Owner: | changed from bill to creike |
Status: | assigned → new |
comment:3 Changed 15 years ago by
Owner: | changed from creike to criecke |
---|
comment:4 Changed 15 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
the referenced site is now obsolete
Sent mail to Steven Grimm (who wrote that page)