Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 653363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:22:26+00:00 2026-05-13T22:22:26+00:00

I have a students xml from a database. The student_state column can have a

  • 0

I have a students xml from a database. The student_state column can have a value of “passed”, among other values (hence the need for switch statement). When the list_changeHandler function is called, depending on the value of student_state, I want a form to display different fields. So I tried to dynamically create the form in actionscript, but it fails to show up when I run the flex application:

import mx.containers.Form;
import mx.containers.FormItem;
import mx.containers.HBox;
import mx.controls.Button;
import mx.controls.ComboBox;
import mx.controls.TextArea;
import mx.controls.TextInput;



[Bindable] 
public var students:XML;
private const CONTEXT_URL:String = "http://localhost:3000";

protected function textInput_enterHandler():void
{
    currentState='List';
}

protected function list_changeHandler():void
{
    currentState='Detail';

    for each (var element:XML in students)
    {

        switch (element.student_state)  {

        case "passed":

            setPass("passing_number_id", "created_at");

        break;
        }


    }



}

function setPass(label:String, contents:String):void
{

    var form:Form;
    var formItem:FormItem;
    var textInput:TextInput;

    var form = new Form();
    var formItem = new FormItem(); 
    var textInput = new TextInput();
    form.addChild(formItem)
    formItem.addChild(textInput)
    addChild(form)  
    // form.includedIn = "Detail"
    form.x = -12
    form.y = 150
    form.id = "detailView"
    form.label = label;
    formItem.label = label;
    textInput.id = label + "TextInput";
    textInput.text = "@{studentsGrid.selectedItem.label}";  



}

Here’s the xml:

<students>
<student>
<student_state>passed</student_state>
<created_at>2010-02-19T17:44:34Z</created_at>
<passing_number_id>4</passing_number_id>
<site_id>1</site_id>
</student>
</students>

Thanks for any response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:22:27+00:00Added an answer on May 13, 2026 at 10:22 pm

    Ok I think I see the problem now,

    for each (var element:XML in students)
    

    will only loop once, because the whole students XML is in students, which has no student_state property, you probably mean

    for each (var element:XML in students.children())
    

    then you are looping on the student node, which does have the child student_state. So that should work, even without the toString() method (not sure on that point, so you might want to try it both ways).

    Familiarize yourself with trace() which you can use to output info to the console. if you had added a trace(element.toXMLString()) inside your for loop you would have seen this for yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xml database with the following format: <Students> <Student ID= *GUID NUMBER*>
I have a XML file like this: <students> <student rollNo=1 Name =A Grade=A/> <student
Iam using Zend RestController to output student data (from database) in xml format. Iam
i am curious to know how can i get the database data in xml
i have the following xml <students> <student> <id>12</id> <name>Mohsan</name> </student> <student> <id>2</id> </student> <student>
hi i have the following xml <students> <student> <id>12</id> <name>Mohsan</name> </student> <student> <id>2</id> <name>Ali</name>
I have an xml as follows <Students xmlns=http://AdapterTest> <Schema name=Schema1 xmlns=urn:schemas-microsoft-com:xml-data xmlns:dt=urn:schemas-microsoft-com:datatypes> <ElementType name=Student
I have declared a bean in student.xml file: <bean id=student1 class=com.raykor.hello.Spring3HelloWorld> <property name=name value=Sachin
I have student.xml file and am parsing this file using SAX Parser and now
for clarity lets say we have students and classes, its a many to many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.