Opened 13 years ago

Closed 12 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 13 years ago by bill

Milestone: 0.5
Owner: changed from Neil Roberts to bill
Status: newassigned

Sent mail to Steven Grimm (who wrote that page)

comment:2 Changed 12 years ago by bill

Milestone: 0.91.0
Owner: changed from bill to creike
Status: assignednew

comment:3 Changed 12 years ago by Adam Peller

Owner: changed from creike to criecke

comment:4 Changed 12 years ago by Adam Peller

Resolution: wontfix
Status: newclosed

the referenced site is now obsolete

Note: See TracTickets for help on using tickets.