Javascript for onchange of a selectlist.

Hi,
I have a requirement. There is a selectlist in my form. Once user selects a value in this, I have to display 6 or 7 fields. How can I write a javascript to do this and attach to the selectlist ? I am new to javascript. Can anyone point me to some examples to do this ?
Thanks
Naresh

Hi Naresh,
There are at least two ways to handle this:
1 - Use a Select List with Submit and apply a Conditional Display to each of the items to display them only when the select list has a particular value. The drawback to this is that you have to submit the page - this may save data on the underlying table(s) and may not be what you want to happen here. The advantage is that this is a typical way of handling the show/hide of fields and can be easily set up using existing Apex functionality; or
2 - Use Javascript to show/hide fields that are already on the page and submit the page only once all fields have been completed as required. The advantage is that you don't have to submit the page until you're ready to do so and there is no round-trip to the server to reload the page to get the fields shown or hidden as required.
In both cases, you may also have to include Page Validation to ensure that only the correct fields' data is written back to the database.
If you want to do option 2, have a look at the following:
http://htmldb.oracle.com/pls/otn/f?p=33642:41
If this is what you want, I'll let you know how it has been set up. Please note that I have done nothing about formatting the page - just the show/hide bits - formatting would be up to you.
Regards
Andy

Similar Messages

  • JavaScript for HTMLDB_ITEM.TEXT

    Do we support Javascript for HTMLDB_ITEM.TEXT ?
    If so let me know the syntax
    Not able to find the same in HTMLDB Help
    thanks
    -prashant

    Hi Got it
    FYI
    HTMLDB_ITEM.TEXT(1,field1,8,10,''onchange=javascript:Hi();'')
    thanks
    -prashant

  • Javascript for multiple date fields

    Hi all-
    I have to write javascript for 15 different date fields in a form.
    The requirement here is that we convert all date fields on Page 100 from date pickers (editable date fields) to display-only date fields with two controls for the users to set the date.
    If the field is empty (no date registered yet), there will be a green checkmark(X). When the user clicks this checkmark, the current date is entered into the field.
    If the field is not empty (there is a date already in the system), there will be a red X. When the user click this red X, the date from the date field is removed.
    The javascript I am using here is
    </script>
    <script type="text/javascript">
         function init(){
              var datePickerVal = $v2('P100_TODAYS_DATE');
              if(datePickerVal){
                   $x_Show('ToggleDateR');
                   $x_Hide('ToggleDateG');
              }else{
                   $x_Hide('ToggleDateR');
                   $x_Show('ToggleDateG');
         function toggleDateFunc(pValue){
              var sysDate = $v2('P100_DATE');
              if(pValue == 'R'){
                   $x_Hide('ToggleDateR');
                   $x_Show('ToggleDateG');
                   $x_Value('P100_TODAYS_DATE','');
              }else if(pValue == 'G'){
                   $x_Show('ToggleDateR');
                   $x_Hide('ToggleDateG');
                   $x_Value('P100_TODAYS_DATE',sysDate);
         window.onload = init;
    </script>
    This javascript is working for one date field( 'P100_TODAYS_DATE') but i have 15 different date fields in this page(100) all should have same funtionality. Please help me out how to write a logic to use this function for all the date fields.
    Thanks,(apex 3.2)
    Greenhorn
    Edited by: Greenhorn on Jul 19, 2011 12:30 PM

    Hi,
    You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
    Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
    Now modify you code as
    FOR i IN 1..30
    LOOP
    v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
    END LOOP;
    ....Now you have all date valus in array. Just write one update as follows
    UPDATE  TABLE1
    SET date1 = my_date_array[1], date2 = my_date_array[2]..
    WHERE ....Hope it helps :)
    Cheers,
    Hari

  • Javascript won't work - JavaScript for Reader Mobile API Reference (Android)

    I have created a Form with the new Adobe Acrobat Pro DC (trial version).
    The Javascript code just won't work on a mobile phone.
    Doc - JavaScript for Reader Mobile API Reference (Android this shows that what I want to do is supported.
    But not even the simplest command will work on my phone. (I am using Adobe Acrobat DC - PDF reader for Android)
    Any suggestions of what I could be doing wrong?
    Best,
    Menno

    A Doc.getField() should work.. Try small steps: Create a document with two fields (e.g. Text1 and Text2), then create a custom calculation script for Text2 that uses the following code:
    event.value = this.getField("Text1").value;
    Does this copy the data you enter in Text1 to Text2?
    Then, add a third field ("Text3") and a button with the following MouseUp JavaScript action:
    this.getField("Text3").value = this.getField("Text1").value;
    Does this work? It actually works for me. To save you some work, here is a link to the test file I've used: http://khkonsulting.com/files/AUC/AndroidTest.pdf

  • 10.8.2 update: can't install "error occurred while evaluating Javascript for the package"

    Greetings All-
    I'm trying to update from 10.8.1 to 10.8.2 on my Macbook Air. When I downloaded the .dmg from Apple and ran it, I got the following error:
    "OS X Update Can't be installed on this disk. An error occurred while evaluating JavaScript for the package."
    So far, I've done the following, all to no avail:
    (1) Updated Java to v7 per Java's website, no change
    (2) Downloaded the 10.8.2 combo update, no change
    (3) Found Apple's OS X Java update (which is still at v6)- get an error at install that "the contents of the disk can't be changed"
    (4) Restarted at each step
    Does anyone have any suggestions or ideas?
    Thanks!

    Permission repair, too?
    Take a look here: https://discussions.apple.com/thread/3811748?start=0&tstart=0
    And possibly here:  https://discussions.apple.com/thread/3889562

  • PDF Form javascript for making readonly field by using button

    Please let me know the PDF Form JavaScript for making selected fields(Text field,Drop down list,..) as read-only by using Button.

    Do you want your button to be made read only?
    One starts with Acrobat JS Reference.
    // make all fields in a form read only;
    var oField; // variable for field being processed;
    // loop through the form fields;
    for (var i = 0; i < this.numFields; i++) {
    // process each field name;
    oField = this.getField(this.getNthFieldName(i)).readonly = true;

  • How do I localize text strings in the javascriptresource section i a Javascript for Photoshop?

    I have made a javascript for photoshop. I am using the <javascriptresource> and <terminology> tags to make the script to work with actions. How do I make the textstrings within the <javascriptresource> section local (translated)? The localize function and other ways to localize text that I described in the documentation do not work.

    I recommend that you post your question in the scripts forum as this forum is meant for beginners. It is not that we won't help, it is that we may not beable to provide the best help. Good luck, I hope you can figure it out.
    http://forums.adobe.com/community/photoshop/photoshop_scripting?view=discussions
    http://forums.adobe.com/community/photoshop/photoshop_sdk?view=discussions

  • Help with embedding Javascript for Lightbox Photo Gallery in Muse!

    Hi all:
    I am fairly new to Muse and I have been having trouble finding relevant information for embedding Javascript in order to get a lightbox to work in Muse. Would anyone be able to walk me through embedding the Javascript for the Lightbox Photogallery for Picasa in Muse?
    This is the code I want to use: Lightbox Photo Gallery and Slideshow for Picasa
    And this is the look I am trying to accomplish within my Muse site: Cycling Around The World / January 2006 / Picasa Template by www.paulvanroekel.nl
    Any help would be appreciate. Thanks much,
    Alexis

    Hi,
    I have tried inserting the script that you have pasted above as HTML on my test site and it worked.
    What happens is whenever you insert something as HTML, Muse by default creates a div tag and places the content within the div tag. What I have done differently is I have inserted the JS with in the <script> tag and it has inserted the Javascript in this manner,
    I beleive that since this a browser re-direct script that you are using, you would like to place this in the head section and not in the body tag, however, that is certainly not possible using Muse as it does not allow access to the code it generates as a muse file.
    You, can still export the pages as HTML and make the appropriate changes there before uploading to the server.
    Hope that helps.
    Regards,

  • "Adobe Photoshop Lightroom 5.4 can't be installed on this disk. An error occurred while evaluating JavaScript for the package."

    Hi there,
    I'm getting this error on trying to install / update LR 5.3 to 5.4:
    "Adobe Photoshop Lightroom 5.2 can't be installed on this disk. An error occurred while evaluating JavaScript for the package."
    I hope there's somebody that can help me out here.
    Cheers

    Hi kglad,
    Sorry for the late response:
    Here's the screenshot you wanted:
    It's in Dutch but it 's exactly the same as posted above by abphoto.biz
    I'm running OS X Maverick on an early iMac (2007). No problems until now.....
    Hope you can help,
    Cheers

  • How to use  Javascript for anchors as I cant get it to work at all?

    I am currently trying to build my own web site using iweb 08. I am a total newby so this question is for anyone who knows about javascript, particularly Cyclosaurus. I have tried in vain to use Cyclosaurus's javascript for anchors in my FAQ's page via html snippet. I must be doing something wrong, so can you help?
    1). I copied and pasted the javascript anchors code into a html snippet
    2). I changed the, anchors.push(3146) to no's 1, 2 and so on for each question
    3). I then changed 'change this to your page' to faq's
    4). I don't understand anything else from this point so please can you help to rectify my total incompetence and explain it in detail.
    This is what i have tried to do.... anchors.push(1);//faq's. followed by my question? y position
    Is this correct or have I gone totally wrong
    Please help
    Many Thanks

    I have finally published my site and yes Cyclosaurus anchors javascript worked great. It won't work when you are working on your site pages, not until you publish your site.
    Follow Cyclosaurus instructions above, it was after where I got stuck. So this is for the many people who need very clear instructions from start to finish. Otherwise you can spend countless hours scrolling through these forums. Here is what you have to do next:
    Each question must be numbered. So your first question would be numbered "1" and so on. Highlight your question at the top of your page. Open inspector and go into hyperlink
    Tick enable hyperlink box and select link to an external page. Delete everything but http:// and type in #1
    Repeat this for each question - next question would be #2 and so on
    Remember to hyper link all your "back to top" or "Top" as #0
    That's it, your good to go to go
    Thanks again to everyone

  • How to validate an text field item using javascript for numbers only.

    hi,
    how to validate an text field item using javascript for numbers only.please help me on this urgent
    please mail me solun if posible on [email protected]

    Hi,
    Page HTML header
    <script>
    function onlyNum(evt) {
      // Usage: onKeyPress="return onlyNum(event)"
      evt = (evt) ? evt : window.event;
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        var status = 'This field accepts numbers only!';
        alert(status);
        return false;
      var status = '';
      return true;
    </script>Item HTML Form Element Attributes
    onKeyPress="return onlyNum(event)"Br,Jari

  • The JavaScript for this page failed to load correctly. Always on shutterfly.

    I'm trying to view photo albums on shutterfly and always get the following error. "The JavaScript for this page failed to load correctly. "

    Howdy there JohnB,
    It sounds like you are unable to access your Shuttefly due to a JavaScript issue in Safari. I would start by checking to see if JavaScript is enabled in the Preferences.
    Enable JavaScript
    JavaScript is a software technology that allows some buttons, online forms, and other webpage content to work properly. To block JavaScript, deselect this checkbox.
    Note: Disabling JavaScript can cause many sites not to work properly.
    From: Safari 6 (OS X Mountain Lion): Security preferences
              http://support.apple.com/kb/PH11886
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • The JavaScript for this page failed to load correctly

    I keep getting this message "The JavaScript for this page failed to load correctly" when I try to access my Shutterfly accounts.
    This is a new problem since upgrading to Mavericks.  It does not happen on my Macbook Pro running Mavericks.
    John

    Howdy there JohnB,
    It sounds like you are unable to access your Shuttefly due to a JavaScript issue in Safari. I would start by checking to see if JavaScript is enabled in the Preferences.
    Enable JavaScript
    JavaScript is a software technology that allows some buttons, online forms, and other webpage content to work properly. To block JavaScript, deselect this checkbox.
    Note: Disabling JavaScript can cause many sites not to work properly.
    From: Safari 6 (OS X Mountain Lion): Security preferences
              http://support.apple.com/kb/PH11886
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Despite my Javascript for Firefox 23 being "enabled" ( I checked re the "about:config" steps), some websites are still asking me to enable my Javascript.

    Despite my Javascript for Firefox 23 being "enabled" ( I checked re the "about:config" steps), some websites are still asking me to enable my Javascript to view content. Safari works without any problem. OS/X 10.8.4

    These files are hidden to me because my OS/X is 10.8.4 and I cannot make them appear. This is way, way more trouble than it's worth. Thanks for your help. Firefox has lost me.

  • How to block javascript for custom sites?

    Sometimes I need to disallow javascript for some sites only. I can do this in Opera. Is this posible in FireFox?
    For example, I don't like the javascript at google.com when I'm searching for images because the images (thumbnails) are increasing size on mouse over. Can I disable javascript for google.com only?

    There is not a built-in way of doing this, but you can add that capability by using the [https://addons.mozilla.org/firefox/addon/4922/ YesScript] add-on.

Maybe you are looking for

  • Why can't I get Back To My Mac to work in both directions between my 2011 Mac Book Air and my 2012 Mac Mini?

    Why can't I get Back To My Mac to work in both directions between my 2011 Mac Book Air and my 2012 Mac Mini? The network uses a Time Capsule. Everything works when connecting from the Mini to the Air, but the reverse is not the case, none of the Mini

  • [ADF-11.1.2] Link on adf tabel does not select row before navigation

    Hi, I have a List of Contries displayed in table with a view button on panel collection toolbar. User Select the country row, which makes changes current row of country View Iterator binding on page, and click on view button, which navigates to detai

  • WLC 7.4 and Flexconnect AP support

    Hi all, Forgive me for not finding it on my own since I am sure it exists. Does anyone have a link to a support chart that shows where support for APs stops on WLC 7.4 code? Specifically, while running APs in Flexconnect mode? Thanks in advance

  • Limit SC Confusion,please Clarify

    Hello All, IN Classic ,SRM 5.0 1.I created a Limit Cart with Option: Confirmation and Invoice selected and it created a PO with Item Category D in backend and in PO, GR Valuated,GR Based IV and INvoice Receipt is flagged.,this came from Vendor Master

  • Garbage folders remain in user data drive

    Patch management generated some working folers(ex. 3d1cd6ffb3eb95d299573bf8bd31) & files in my d: (user data drive). Some of these folder remain in the drive after patching and these folders could not be deleted by Win7 user without admin rights. Is