Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'dropdownlist'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 3 results

  1. Hi there, As a YII2 beginner, i have a very easy question, and i was really surprised to not find the answer by myself on the internet but i have to say that after some research i didn't find anything. Question is: How to get the current value of a dropDownList into a view? (to fill a grid depending of the value of the dropDownList) So here is my code: <?= $form->field($model, 'spe')->dropDownList( ArrayHelper::map(Specialites::find()->all(), 'id_spe', 'lib_spe'), [ 'prompt'=>'Choose a spe', ])->label('Spécialité'); ?> <?php $dataProvider = new ActiveDataProvider([ 'query' => Parcours::find()->where(['fk_parcours_spe'=>'/*NEED ID_SPE HERE*/']), 'pagination' => [ 'pageSize' => 20, ], ]); echo GridView::widget([ 'dataProvider' => $dataProvider, ]); ?> So as you can see: i need to get the id_spe of the dropdownlist right on top of my grid, it seems so easy (like spe.val() in JS) but i can't manage to find how to do so =P Could you help me with this? thanks before. babakitien
  2. Hi, I've created a drop down list of user's names, that I've concatenated from first_name and last_name in a database table. And it works perfectly! Here's what I've got: User Model: public function getFullName() { return $this->first_name . " " . $this->last_name; } StudentRecordController, in actionCreate(): $students = CHtml::listData(User::model()->with('studentRecords')->findAll(), 'id', 'FullName'); And in views/studentRecord/_form.php: <?php echo $form->dropDownList($model, 'user_id', $students, array('empty' => 'Select Student Name')); ?> My question is, how is the getFullName() method called by the third argument to listData, which is 'FullName'? The "get" is parsed out? If I use the full method name instead (getFullName), it does'nt work. And actually fullname, fullName, FuLlNaMe all work. Bear in mind, that with this approach, you have to include the $students array in the render method of the controller and the view. Larry Z.
  3. Dear Larry, I recently got your book and eagerly read it (I've read and tried 7 chapters in 3 days). I knew Flex when version 3 was in beta, but never programmed anything. I've just finished chapter 8 and tried to bind the drop down list showing the Departments using a simple query to the database in the same fashion you populate the grid with the employees. The PHP file i'm using is (getDepartments.php): <?php header('Content-Type: text/xml'); echo '<?xml version="1.0" encoding="utf-8" ?><departments>'; require_once('mysql.inc.php'); $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, 3306); if ($dbc) { $q = "SELECT * from departments ORDER by 1"; //printf("\n%s",$q); $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) > 0) { while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { echo "<department> <id>{$row['id'] }</id> <Name>{$row['name'] }</Name> </department> ";} // End of WHILE loop } // End of mysqli_num_rows( ) IF } // End of $dbc IF echo '</departments>'; ?> Inside the declarations section I declare: <s:HTTPService id="getDepartmentsService" url="http://localhost/~Jorge/flex4ch08/getDepartments.php" method="GET" resultFormat="e4x" result="getDepartmentsResult(event)" fault="serviceFault(event)"> </s:HTTPService> I included the script: private function getDepartmentsResult(event:ResultEvent):void { departmentsList= event.result.department; } And in the MXML application I tried: <mx:FormItem label="Department"> <s:DropDownList id="employeeDepartment" dataProvider="{departmentsList}" labelField="name" prompt="Select one:"></s:DropDownList></mx:FormItem> And keep getting the error: 1067: Implicit coercion of a value of type XMLList to an unrelated type mx.collections:IList I thought I was very clever trying to replace the hardcoded list you included with this query which is now giving me headaches. Can you help me?
×
×
  • Create New...