How to validate and save the values to a combo box and two text boxes in flex4 mxml application with as3

helllo all,.

I'm working on the application web flex4 with as3.

I have a doubt, I've created a mxml it has two text boxes, except the button and a combo box that is has two option as a percentage and the amount.

my needs are I gave here.

need 1: when I choose option amount that two text boxes does not have to be editable.when I select text tat box two percentage option will be editable.

need 2: when I select the percentage in combox option and two text boxes are empty, and then click the button Save-> I want to display warning msg

need 3: when I select the option amount combox and the two boxes are emptu click the button Save-> I don't want any warning messages.

How to validate it and how to write backup for this function.

any suggession or extract code is welcome.

Thanks in advance,

B.Venkatesan

Looks like you are trying to do too much at once. Try to hang the events correctly

The close event of the comboBox can do something like this

protected function toggleTextEditing(event:DropDownEvent):void

{

If (this.optionCmb.selectedItem.label is "Percentage")

{

This.Text1.editable = true;

This.Text2.editable = true;

}

Else if (this.optionCmb.selectedItem.label == "Number")

{

This.Text1.editable = false;

This.Text2.editable = false;

}

}

The button's click event can do something like

protected function save(event:MouseEvent):void

{

If (this.optionCmb.selectedItem.label is "Percentage")

{

If (this.text1.text == "" & this.text2.text == "")

{

Alert.Show ("text is empty");

return;

}

on the other

{

}

}

Else if (this.optionCmb.selectedItem.label == "Number")

{

}

}

If you can put in your entire code, maybe I can have a look to see if I can find something wrong with that.

-Pramod

http://www.flexmycode.com

Tags: Flex

Similar Questions

  • Save the State of a combo box

    I created a listbox control that has a number of items in there and then I created 'Up' and 'Arrows' to allow the user to move the items in the listbox control to specify the order they want. The problem I have is when I save the document that the State of the list box is not preserved. Here is the code that I used to record allow the user to move the elements upwards or downwards. Please let me know if it is possible to save the State or if I need to find another solution to this requirement.

    Try

    {

    if(ListBox1.selectedIndex>0)

    {

    var selectedItem = ListBox1.items.nodes.item (ListBox1.selectedIndex)

    ListBox1.items.nodes.insert (selectedItem, ListBox1.items.nodes.item(ListBox1.selectedIndex-1))

    }

    } catch (e)

    {

    app.alert(e+'');

    }

    Usually by checking the setting automatically for the "backup script changes to registration form" option in the properties of the form and the default tab.

    Thank you

    Srini

  • How to use the value in a combo box as a parameter "with these values?

    Hello, new user.

    I have a box of drop-down list on Page 1, on which the user can choose a number of study. The list box is named "P1_STUDY_NBR".

    Then I have a list, a single entry that goes to my form master / detail, which is Page 6. I would like him to go the number of study that the user choose on Page 1.

    In my goal on the list to create/edit entry, I put in the 'Page of this Application"," Page 6 ", then in any of these items, I put in."
    P6_STUDY_NBR

    My question is what to use with these values, where I want the content of the P1_STUDY_NBR. I tried:
    & P1_STUDY_NBR

    and it does not work. If I put in one of the numbers in the study, as 336-00, then it works, but I want to increase the number of study that the user chooses in the drop-down list. What should I do for P1_STUDY_NBR content?

    -Mary

    Hello

    The format should be:

    &P1_STUDY_NBR.
    

    You seem to miss the point at the end

    Andy

  • How to validate button Save

    Hello

    How to validate button 'save '? Requirement is at the advanced table I have lov fields 'Application name' and 'name of responsibility. " If I choose the two lov then only it will save the records.else, it will show a message "enter values in 2 fields. I use code code below.



    If (PageContext.GetParameter ('Save')! = null)
    {

    RequestAccessDetailsVOImpl vo = am.getRequestAccessDetailsVO1 ();
    Line row = vo.first ();
    String p_appl_name = null;
    String p_resp_name = null;

    for (int i = 0; i < vo.getRowCount (); i ++)
    {
    p_appl_name = Row.GetAttribute ("ApplicationName"). ToString();
    p_resp_name = Row.GetAttribute ("ResponsibilityName"). ToString();
    p_username = PageContext.GetUserName (). ToString();
    System.out.println ("application name is" + p_appl_name);
    System.out.println ("name of responsibility is" + p_resp_name);

    }
    Row = VO. Next();

    If (((p_appl_name)! = null) & & ((p_resp_name)! = null))
    {
    System.out.println ("Working");
    am.getOADBTransaction () .commit ();
    System.out.println("6");
    throw new OAException ("successfully", OAException.INFORMATION Records);
    }
    on the other
    {
    throw new OAException ("Enter the two fields", OAException.INFORMATION);
    }

    }



    IAM get 'Application name' and values "name of responsibility." If I select the two values it works well, but if the option not all lov is showing below error.



    Details of the exception.

    oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
    at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
    at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
    at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
    at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
    in OA. jspService(OA.jsp:40)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    # # 0 in detail
    java.lang.NullPointerException
    at wnsgs.oracle.apps.sysadmin.requestforaccess.webui.RequestAccessDetailsCO.processFormRequest(RequestAccessDetailsCO.java:155)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
    at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
    at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
    at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
    in OA. jspService(OA.jsp:40)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    java.lang.NullPointerException
    at wnsgs.oracle.apps.sysadmin.requestforaccess.webui.RequestAccessDetailsCO.processFormRequest(RequestAccessDetailsCO.java:155)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
    at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
    at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
    at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
    in OA. jspService(OA.jsp:40)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)




    Can someone help me how to solve this error.

    Thank you
    NGO

    p_appl_name = Row.GetAttribute ("ApplicationName"). ToString();

    The statement generates error if row.getAttribute("ApplicationName") returns null as he tries to toString() to null.
    So it correctly handles to null values.

    p_appl_name = (String) row. GetAttribute ("ApplicationName");
    p_resp_name = (String) row. GetAttribute ("ResponsibilityName");

    It should work... If you are still having problem... very unlikely... in this scenario, you use only
    Object p_appl_name = row.getAttribute ("ApplicationName");
    Object p_resp_name = row.getAttribute ("ResponsibilityName");

    If you use over construction of the object then you will need to convert the objects to strings if you view them, but the comparison they work always as is.

    Kind regards
    Stephanie.

  • How promt user to save the changes when you change the non-base fields?

    Hello
    I have a form with two tabs. The datablock Block_1 on tab_2 is based on a view of database. But all the displayed items of the Block_1 are non-base of data elements. Whenever a user changes some elements of Block_1 and press the button Save, the values of non_db elements copied from the db_items (based on the view), and commit_form is called. It works very well.
    But the problem here is: after the change of some elements of block_1, if the user navigates to another form/option in the menu, the shape is not promt the user to 'save changes' and all changes are lost. How can I fix it?
    I have a form level key-release trigger, (which does not fire) with the following code: -.
    Declare
      X  Number;
      alert_is             alert;
    Begin
          
    If :System.Mode = 'ENTER-QUERY' Then
         
            Exit_Form;
           
    Else
      If :System.Form_Status In ('NEW','QUERY') Then
           alert_is := FIND_ALERT('TMPL_EXIT'); -- "Are you sure you want to exit?"
        X := Show_Alert('TMPL_EXIT');
        
        If X = Alert_Button1 Then
           Exit_Form(no_validate);
        End If;
        Else
           Exit_Form;
      End If;
    End If;
    End;

    When button preesed trigger that fills your block:

    --somewhere in loop after NEXT-RECORD and assigning values:
    set_record_property (:system.cursor_record, :system.cursor_block, STATUS, QUERY_STATUS );
    

    Now you can copy the values of the elements not db to db items in when-validate-item.

    Of course, it is a quick fix and dirty. Good way would be to solidarity block using EXECUTE QUERY, delete everything in mirror and do you calculations in a trigger post-requete

    Published by: Slava Natapov on December 9, 2009 14:18

  • Save the value of a Boolean variable

    How can I save the value of a Boolean variable, so that when I open the file, it can be with the parameters in which I left?

    I created the variable to the top of the frame:

    var audio:Boolean = true;
    

    And I added the conditions for the buttons:

    if(audio == true) {
        Sound.play();
      }
    

    But whenever I open the application preferences is reset to true, wanted to leave with this preference be saved in the case of boolean, true (enabled) or false (disabled).

    can someone help me? Please, I beg you.

    Thanks in advance!

    A sharedObject is always appropriate for a local application. The only reason to use anything else would be size of storage needs.

  • After editing an image in windows Photo Gallery can't save the picture. I get a message that tells me that something is wrong with the application. How to fix this problem?

    After editing an image in windows Photo Gallery can't save the picture. I get a message that tells me that something is wrong with the application. How to fix this problem?

    Hello

    I suggest you to refer to this link and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/Windows-Photo-Gallery-frequently-asked-questions

    It will be useful.

  • How can I retrieve all the values in a single query in the oracle XML

    Hi all

    I have xml format below, how do I retrieve all the values in a single query.

    < files >

    < job > MANAGER < / job >

    < details >

    < ename > JONES < / ename >

    < sal > 2975 < / sal >

    < ename > BLAKE < / ename >

    < sal > 2850 < / sal >

    < ename > CLARK < / ename >

    < sal > 2450 < / sal >

    < / details >

    < / documents >

    Thank you

    I prefer desgin a little more sophisticated xml and wrap the details in a separate label.

    Then you could something like that

    1 with testdata until)
    2. Select xmltype)
    3'
    4 MANAGER
    5


    6
    7 JONES
    8 2975
    9

    10
    11 BLAKE
    12 2850
    13

    14
    15 CLARK
    16 2450
    17

    18

    19
    20 ') in the form x
    21 double
    22)
    23 select
    24 j.job
    25, d.ename
    26, d.sal
    27 of testdata
    28 join
    29 xmltable ("Scriptures" in passing testdata.x)
    30 columns
    31 job varchar2 (30) path "job."
    32, details xmltype path «details»
    (33) j
    34 (1 = 1)
    left outer join 35
    36 xmltable (' details/emp' in passing j.details)
    37 columns
    path of varchar2 (30) 38 'ename' ename
    39, path of varchar2 (30) sal "sal".
    (40) d
    41 * (1 = 1)
    >/

    JOB                            ENAME                          SAL
    ------------------------------ ------------------------------ ----------
    JONES MANAGER 2975
    BLAKE MANAGER 2850
    MANAGER CLARK 2450

  • I downloaded the new version and it says: you cannot use this application with this version of Mac os how can I download the older version?

    I downloaded the new version and it says: you cannot use this application with this version of Mac os how can I download the older version? My os is 10.4.11

    You can read this article: Firefox no longer works with Mac OS X 10.4 or PowerPC processors to read about the EOL for Mac 10.4 support and what the best options going forward.

  • How to copy and paste text from the page of the book one photo to another.

    Hello, I downloaded this software 2 days ago, and I had so much fun with it. pls I need help on how to copy and paste text from the page of the book one photo to another. Second, how to copy my photo book completed pages project to another laptop computer for printing. Thank you

    Wow! I solved the first problem, I clicked on 'ctrl c' to copy and "ctrl v" to paste. yipppppeee! now am loving this software d most just need help with the second question now

  • How to add and edit text in the form created by adobe acrobat 9?

    How to add and edit text in the form created by adobe acrobat 9?

    Actually, that's exactly what you should do, you don't need to create

    all fields again.

    After you have edited the original and create a new static PDF, open the old

    version and use the command replace Pages to insert the new pages

    those in the old file. This will keep all the form fields in tact.

    Tuesday, August 25, 2015 at 10:28, susanna323 [email protected]>

  • How to cut and paste text in the css code in dw cc?

    How to cut and paste text in the css code in dw cc? I have only licensed a few days ago, it worked fine in trial! Thank you...

    Copy the code into Notepad (Windows Machine) or MAC (copy in texteditor) & pasting in DW, I think that his work.

  • How can I do a multiple selection in Enum control or control of the ring or control Combo box

    How can I do a multiple selection in Enum control or control of the ring or control Combo box

    You can not.

    You can use a listbox control.

    An alternative solution is to write the code and each selection, the user gives an enum, for example, can be send to a table and invite the user to continue to select...

  • How to delete a selected line using a button located outside the datagrid in flex4 mxml application

    Hi friends,

    I'm new to flex, I use flex4 mxml application, I have my doubts... Help, please.

    My requirement is that I use a grid.i of data data should this datagrid from another window contextual and recorded the details datagrid now, too, I want to remove a record from a data grid

    I use a datagrid. a save button and remove the two buttons are placed outside the grid of data. so once I click on a row of the data grid and click on remove the medium button this record should delete data grid.


    All codes suggession and extract are welcome.

    Thanks in advance,

    B.Venkatesan

    Hello

    This code can help you:

    http://www.Adobe.com/2006/mxml"layout ="absolute"viewSourceURL =" srcview/index.html">"

    Import mx.controls.CheckBox;

    Import mx.collections.ArrayCollection;

    Import mx.controls.Alert;

    public var dp:ArrayCollection = new ArrayCollection();

    public void addRow (): void

    {

    var tmp:Object = new Object();

    tmp ["amount"] = 100;

    dp.addItem (tmp);

    }

    public function delRow (): void

    {

    If (dgFee.selectedIndex! = - 1).

    dp.removeItemAt (dgFee.selectedIndex);

    }

    ]]>

    Thank you and best regards,

    -----------------------------------------------------------------------------------------

    Vibhuti Gosavi . [email protected] | www.infocepts.com

    -----------------------------------------------------------------------------------------

  • How to save the value controls in labview

    Hello
    I want to know how to record the value of controls in the PC. means if I attribute 5 numeric value to a control, he has to stay there even I restart my PC.

    And here is a simple example of using - http://decibel.ni.com/content/docs/DOC-15349

Maybe you are looking for