This discussion is archived
6 Replies Latest reply: Feb 1, 2013 12:49 PM by fac586 RSS

how to append textfield value to select list value before saving the record

bp21 Newbie
Currently Being Moderated
Hi,

I have a select list called 'Product List' with list of values populated from database. Also, it has one static value 'Other: Specify'. When the user selects 'Other: Specify' option, a textfield below select list becomes visible(default hidden). I cannot tie two items with same database column 'Product_List'. Hence I want to append value of textfield with select list value 'Other: Specify' before storing in database. How can I achieve this? Can anyone help please?


I am using :

Application Express 4.1.0.00.32
DB details - Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Web server architecture - APEX listener
Browser(s) and version(s) used - Chrome version 24/ Firefox version 3.6 and version 18

Thanks!
  • 1. Re: how to append textfield value to select list value before saving the record
    fac586 Guru
    Currently Being Moderated
    bp21 wrote:

    I have a select list called 'Product List' with list of values populated from database. Also, it has one static value 'Other: Specify'. When the user selects 'Other: Specify' option, a textfield below select list becomes visible(default hidden). I cannot tie two items with same database column 'Product_List'. Hence I want to append value of textfield with select list value 'Other: Specify' before storing in database. How can I achieve this? Can anyone help please?
    Assuming the database processing is performed using a wizard-generated ARP, use a conditional Computation.

    Item Type: Item on This Page
    Compute Item: <item to be saved to database>
    Computation Point: After Submit
    Computation Type: PL/SQL Expression
    Computation:
    'Other: ' || :P1_TEXTFIELD
    Condition Type: Value of Item in Expression 1 is NOT NULL
    Expression 1: P1_TEXTFIELD

    You should also have a Not Null Validation on <tt>P1_TEXTFIELD</tt>, conditional on the Product List item containing 'Other: Specify'.
  • 2. Re: how to append textfield value to select list value before saving the record
    bp21 Newbie
    Currently Being Moderated
    Hi fac586,

    Thank you for your response. That worked. I have another similar requirement. On selecting a value in first select list, second item changes to select list(default is text field) depending on the value selected. And second select list is like "Product List" only like previous one which has static value "Other: Specify". On selection of "Other: Specify" a textfield appears and that value is concatenated.

    Can I have conditional computation based on whether item is shown or hidden at run time and particular value selected in select list? If so, how can I do this? Can you help me?

    Thanks!
  • 3. Re: how to append textfield value to select list value before saving the record
    fac586 Guru
    Currently Being Moderated
    bp21 wrote:

    Thank you for your response. That worked. I have another similar requirement. On selecting a value in first select list, second item changes to select list(default is text field) depending on the value selected. And second select list is like "Product List" only like previous one which has static value "Other: Specify". On selection of "Other: Specify" a textfield appears and that value is concatenated.
    It sounds very, very similar. I would not anticipate any significant difference from the method above.
    Can I have conditional computation based on whether item is shown or hidden at run time and particular value selected in select list?
    No. Whether an item is shown or hidden in the browser is not known in APEX where conditions are evaluated. The available conditions are listed in the documentation.

    Evaluate the values of multiple items using PL/SQL Expression conditions:
        :p1_select_list1 = 'FOO'
    and :p2_select_list2 = 'Other: Specify'
  • 4. Re: how to append textfield value to select list value before saving the record
    bp21 Newbie
    Currently Being Moderated
    Thanks fac586. But I am looking for two different computations, each based on different conditions for a single item. I tried having two conditional computations for a single item. It doesn't seem to work. Any work around for this?

    the computations and conditions are done for the second textfield which is shown(instead of second select list) for most values in first select list otherwise hidden :

    1) computation:
    :p2_textfield = :p2_select_list
    condition:
    :p1_select_list='some value1'
    and
    :p2_select_list != 'Other: Specify'
    2)computation:
    :p2_textfield = :p2_select_list || :p3_other_textfield
    condition:
    :p1_select_list='some value1'
    and
    :p2_select_list='Other: Specify'
    Thanks again!
  • 5. Re: how to append textfield value to select list value before saving the record
    bp21 Newbie
    Currently Being Moderated
    Hi fac586,

    I got it working. There was a small mistake I was doing. I was using wrong comparison operator i.e. !=


    Thanks!

    Edited by: bp21 on Feb 1, 2013 5:46 AM
  • 6. Re: how to append textfield value to select list value before saving the record
    fac586 Guru
    Currently Being Moderated
    bp21 wrote:
    Hi fac586,

    I got it working. There was a small mistake I was doing. I was using wrong comparison operator i.e. !=
    There's nothing wrong with using "!=" as an inequality operator, but it would be wrong to use it if you're not evaluating an inequality expression... ;-)

    If you've solved the original problem, then close this thread by marking it as answered.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points