Conditional Javascript on Checkbox

Hi,
i have recreated Vikas example of http://htmldb.oracle.com/pls/otn/f?p=24317:203
and it works fine.
My problem is that I have a checkbox as well in my report
and whenever I want to check that,the page automatically directs
to the emp details.
How can I check by javascript when a checkbox is clicked in the report
and therefore not be directed to emp details.
Ody

Hello,
It seems that you have added something like this in your report templates..
"onClick=doLink(this)"
on all the table rows.. Note that its is not just the check boxes but clicking anywhere on the row takes us to a new page..
Remove that from the template or wherever you are adding it to..
Or you can edit the function to be called onclick on a button
like
function do_link(this)
var list=document.getElementsByName('f01');
//traverse the list and find the checked button and now
//pop up data appropriatley..
Thanks,
Venkat
Message was edited by:
VENKAT

Similar Messages

  • Javascript controlled checkboxes

    Is it possible to create javascript controlled checkboxes in htmldb.
    Script should disable checking BOTH checkboxes.
    Here is one example of this javascript:
    <input type=checkbox name="k1" onClick="checkit(this)"> First <br>
    <input type=checkbox name="k2" onClick="checkit(this)"> Second
    <script>
    function checkit(nupp)
         if(nupp.name=='k1'&&nupp.checked)
         form.k2.checked=false;
         if(nupp.name=='k2'&&nupp.checked)
         form.k1.checked=false;
    </script>
    I see no ways to put this
    onClick="checkit(this)"
    to htmldb item checkbox.
    Has someone also had same kind of problem and are tere any good solutions.
    Kaur

    Kaur,
    Please take a look at our JavaScript How-To document:
    http://www.oracle.com/technology/products/database/htmldb/howtos/htmldb_javascript_howto2.html
    Thanks,
    - Scott -

  • Can I have a conditional javascript:apex.confirm when column is null

    Hi All,
    I am relatively new to the product but am picking up things all the time. I was recently asked to create a confirmation on submit dialog which I did quite easily using javascript:apex.confirm. I was then asked to only display the confirmation message if a comment column was empty. The column is optional but it is preferred if something is added. I am using 4.1.1. Is this possible? Any ideas would be appreciated
    Regards
    Chris

    Hello Chris,
    >
    user4023958 wrote:
    I am relatively new to the product but am picking up things all the time. I was recently asked to create a confirmation on submit dialog which I did quite easily using javascript:apex.confirm. I was then asked to only display the confirmation message if a comment column was empty. The column is optional but it is preferred if something is added. I am using 4.1.1. Is this possible? Any ideas would be appreciated.
    >
    How have you implemented the apex.confirm?
    <ul>
    <li>If you have done it in dynamic action on button click then you have to make the dynamic action conditional by using Item/Column value is not null condition with expression as your comment item say P1_COMMENTS</li>
    <li>If you have done it in Button Action as Redirect to URL then simply you can write a javascript function in your page header as :
    <script type="text/javascript">
    function f_showConfirm () {
      if ($x('P1_COMMENTS').value == '') {
        apex.confirm('Do you want to submit this page?', 'SUBMIT');
      } else {
        apex.submit('SUBMIT');
    </script>and call this javascript function in Button Action - Redirect to URL with URL Target set as:
    javascript:f_showConfirm();</li>
    </ul>
    In order to get accurate/appropriate response you should include relevant details from following information with your question:
    <ul>
    <li>Full APEX version</li>
    <li>Full Database version</li>
    <li>APEX Web server architecture (EPG, OHS or APEX listener)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Operating system with version, architecture(32/64)</li>
    <li>Theme</li>
    <li>Template(s)</li>
    <li>Region/item type(s)</li>
    </ul>
    The above information will help the forum members to ascertain the problem context and post most relevant response.
    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.
    Please update your forum profile with a real handle instead of user4023958.
    Hope it helps!
    Regards,
    Kiran

  • DYNAMIC ACTION - Javascript Expression checkbox

    Hello
    I have 2 items
    1.     P2_REQUEST_TYPE_CODE
    a.     SELECT LIST
    i.     EQUIPMENT REV
    ii.     POSTER
    iii.     ROOM SHELL
    iv.     VISIO TO CAD
    2.     P2_RETURNED_FILE_TYPE_CODE
    a.     CHECKBOX
    i.     2D POSTER
    ii.     CAD DRAWING
    iii.     PDF
    iv.     VISIO
    I Have a Dynamic Action
    Event: Change
    Selection Type : Item(s)
    Item(s): P2_RETURNED_FILE_TYPE_CODE,P2_REQUEST_TYPE_CODE
    Condition: JavsScript Expression
    Value:
    $v('P2_RETURNED_FILE_TYPE_CODE')=='2D POSTER'||
    $v('P2_REQUEST_TYPE_CODE')=='POSTER'
    When my user chooses “P2_REQUEST_TYPE_CODE (“POSTER” )”it needs to displays Address Columns and it does. When my user chooses “P2_RETURNED_FILE_TYPE_CODE (“2D POSTER”)” It needs to display address Columns and it does. Everything works fine except when in “P2_RETURNED_FILE_TYPE_CODE” all checkboxes are checked the address columns don’t get display, any idea?
    Application Express 4.1.1.00.23
    Thanks
    -JC

    Hi JC,
    If you check multiply checkboxes the value will be a string with the value separated by a colon.
    You shoudl use something like indexOf.
    $v('P2_RETURNED_FILE_TYPE_CODE')=='2D POSTER'||
    $v('P2_REQUEST_TYPE_CODE').indexOf('POSTER') != -1Regards,
    Kees Vlek
    http://www.orcado.nl
    http://www.orcado.nl/blog/blogger/listings/69-kvlek
    If the question is answered please change it to answered.

  • Javascript with checkboxes

    Hi,
    I am trying to use to javascript to control checkboxes so that when checkbox1 is selected, checkbox2 is deselected and vice versa. Only one checkbox can be selected at a time.
    I know this is fairly simple but I am a novice so I would appreciate some guidance if possible.
    Thanks a lot :)

    you can save the form, open it in designer & check the javascript -
    Edit: just checked myself.. on click of each checkbox, they are setting each of the other checkboxes to their Off value (0 in this case which is also the default I think)
    This is the script on Checkbox of name Type_Box_1 - As you can see, they are setting all checkboxes to zero apart from the one the user will click: (Type_Box_01 is missing from the following)
    Type.Type_Box_02.rawValue =
    Type.Type_Box_03.rawValue =
    Type.Type_Box_04.rawValue =
    Type.Type_Box_05.rawValue =
    Type.Type_Box_06.rawValue =
    Type.Type_Box_07.rawValue =
    Type.Type_Box_08.rawValue =
    Type.Type_Box_09.rawValue = 0;

  • HTMLB and Javascript: Dependent Checkboxes

    Hello Collegues,
    i try to programming a search component with some dependent checkboxes. For example the user should check "checkbox 1" and there should be "checkbox 2" also selected.
    I write this small example for this. But it dont works. I thing i have an mistake in the onClientClick function. Does somebody knows the right way to do this?
    public class SearchLocalization extends AbstractPortalComponent
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
              //response.write("Javascript Checkbox Test<br>");     
              IPageContext myContext = PageContextFactory.createPageContext(request, response);
              if (myContext == null) {
                   response.write("myContext == null");
              Form myForm = myContext.createFormDocument("Javascript Checkbox Test");     
              GridLayout gl = new GridLayout();          
              Checkbox one = new Checkbox("one");
              one.setText("One");          
              gl.addComponent(1,1,one);
              Checkbox two = new Checkbox("two");
              two.setText("two");     
              gl.addComponent(1,2,two);
              myForm.addComponent(gl);
              two.setOnClientClick("javascript:one.checked = true;");          
              myContext.render();                    
    Best regards,
    Patrick

    Hi Patrick,
       Create a JSPDynPage and in the jsp, u can code javascript like this. I just checked and it is working for me.
    <%@taglib uri="tagLib" prefix="hbj"%>
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
        <script language="javascript">
       function checkme(){
                 var funcName = htmlb_formid+"_getHtmlbElementId";
             func = window[funcName];
             var check1 = eval(func("Check1"));
             var check2 = eval(func("Check2"));
            var check1status = check1.getChecked();
            if(check1status==true){
                   check2.setChecked(true);
      </script>
       <hbj:form id="myFormId" >
          <hbj:checkbox
                   id="Check1"
                   text="Check1"
                   tooltip="Check1"
                   disabled="false"
                   checked="false"
                   jsObjectNeeded="true"
                   onClientClick="javascript:checkme();"
             />
         <hbj:checkbox
          id="Check2"
          text="Check2"
          tooltip="Check2"
          disabled="false"
          jsObjectNeeded="true"
          checked="false"
        />
       </hbj:form>
      </hbj:page>
    </hbj:content>
    Regards,
    Harini S

  • Javascript, a checkbox and an onload script question.

    I have a checkbox item named P8_EQUIPMENT dynamically populated from a LOV.
    Right now it has 16 choices, if the "Other" choice is checked then it shows another text field, if unchecked it hides the text field.
    The value of the choice "Other" will always be 1000 but the id and name could change at run time if more choices are added to the table.
    The "HTML Form Element Attributes" of P8_EQUIPMENT has an
    onclick="javascript:f_otherEquip(this);"
    Works great!
    function f_otherEquip(pthis){
    alert(pthis.id);
    alert(pthis.name);
    if (isEmpty(pthis.value)) {
    alert('f_otherEquip is hitting NULL');
    } else if (pthis.value == '1000') {
    if (pthis.checked) {
    html_ShowItemRow('P8_EQUIP_OTHER');
    } else {
    html_HideItemRow('P8_EQUIP_OTHER');
    Now... I want to call f_otherEquip(pthis) from the page ONLOAD
    What is the correct syntax for "pthis"?
    I've tried f_otherEquip(html_GetElement('P8_EQUIPMENT'));
    and a few others...
    Thanks, Bill

    Try this
    function html_GetCheckbox(p_item_name)
      var l_array=new Array();
      var re=new RegExp('^'+p_item_name.toUpperCase()+"_[0-9]+$");
      var inputs=document.getElementsByTagName('input');
      for (var j=0,l=inputs.length;j<l;j++)
         if (inputs[j].type=="checkbox" && inputs[j].id && inputs[j].id.match(re))
            l_array[l_array.length]=inputs[j];
      return l_array;
    }This will return all the checkbox (input elements) given the Apex item name.
    Now you can do
    function f_otherEquip(p_item_name)
      var boxes=html_GetCheckbox(p_item_name);
      for (var j=0;j<boxes.length;j++) {
        if (boxes[j].value=="1000") {
           if (boxes[j].checked) html_ShowItemRow('P8_EQUIP_OTHER');
           else                        html_HideItemRow('P8_EQUIP_OTHER');
    }Hope this helps.

  • Show report conditionally by checked checkbox

    All,
    I created 8 checkboxes:
    ‘Source’
    STATIC2:a;1,b;2,c;3,d;4,e;5,f;6,g;7,h;8
    Depending on c (checked) I want to show a report.
    Condition of Report:
    ‘PL/SQL function Body Returning a Boolean’
    begin
    if (:c= '3') then
    return true;
    else
    return false;
    end if;
    end;
    But it doesn’t work.
    Any help appreciated,
    Cheers
    lucio

    I believe if you select multiple items it wills separate them with a ':'. So try this:
    begin
       if (instr(:P1_SOURCE,'3') != 0) then
          return true;
       else
          return false;
       end if;
    end;Replacing :P1_SOURCE with whatever your checkbox is named as.
    Hope this helps,
    Aaron
    Edited by: aaron22 on Dec 10, 2009 7:58 AM

  • Region condition: javascript is enabled?

    Hey all,
    I'm trying to think of a way to only display a region if javascript is enabled.....
    Any ideas?
    Thanks,
    Jonathan

    Here's the scenario:
    -- I'm passing a query by URL to a pop-up window.
    -- Unfortunately, I have found at least one case under which IE clears the session state of the new window window is forced to re-authenticate (SSO isn't even carried over).
    -- To counter this, I made the popup window public.
    -- However, I'm now left with a public page that anyone can send a query to and get database information back.
    -- In response, I implemented a JS function to ensure the authenticate the parent of the popup, if there even is one.
    -- However, if JS is disabled, this check doesn't happen and everything shows regardless.
    That's why I was wanting to find a way to have the report region conditional on JS being enabled. (Alternatively, does anyone know if it is standard IE behaviour that every window has an independent session state -- or if there is a way to fix this if it is not?)

  • Another Javascript issue (CheckBox onClick event)

    Hello All,
    I am using NWDS04s Adobe Designer 7.1.
    I created a IF with a TextField on it and a CheckBox. What i would like to do is, when the checkbox is checked, the TextField should disappear (TextField1.Presence = "hidden").
    I wrote this script in the OnClick event of the Checkbox:
    if (CheckBox1.rawValue == "1") {
                TextField1.presence = "hidden";
    }else {
                 TextField1.presence = "visible";
    When i deploy my WD you could guess, it's not working ;-((
    Is there something i am doing wrong??
    When i place this code in the Initialize event of the CheckBox and change the If statement to CheckBox1.rawValue == "0" it works as expected.
    Hope somebody can help me or try it on there machines. Maybe it's a bug.
    Thx in advance.
    Kind Regards,
    Maarten

    Hello Maarten,
    Please have a look at method <a href="https://media.sdn.sap.com/javadocs/NW04s/SPS7/wd/com/sap/tc/webdynpro/clientserver/adobe/pdfdocument/api/IWDPDFDocumentInteractiveFormContext.html#setDynamic(boolean)">setDynamic</a> (interface IWDPDFDocumentInteractiveFormContext).
    Regards,
    Philipp

  • Formvalidation conditional on checkbox

    I have a form (payment) where users enter creditcard information. All fields are required.
    Except
    Some users may choose to have their credit card information collected by phone.
    In that case, they check a Checkbox (input name="Later" type="checkbox" id="Later" value="Ph")
    How do I make the validation conditional on the checkbox not being checked?
    This is my validation Script:
    function MM_validateForm() { //v4.0
      if (document.getElementById){
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
        for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
          if (val) { nm=val.name; if ((val=val.value)!="") {
            if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
              if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
            } else if (test!='R') { num = parseFloat(val);
              if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
              if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
                min=test.substring(8,p); max=test.substring(p+1);
                if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
          } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
        } if (errors) alert('The following error(s) occurred:\n'+errors);
        document.MM_returnValue = (errors == '');

    Just have the user disable javascript to circumvent the required form fields.

  • How to Disable CheckBox for a Particular Condition

    Hi All,
    In my application, iam using one table having 5rows , with checkboxes,
    based on one condition i want to  make few checkboxes as default disable in the same table, and some checkboxes i shud make it as enable, so experts please help me how to disable some checkboxes.
    disable means even if we select it shud not get selected, like that is it possible,

    Hi Sushma,
    You can have one more attribute in the same node from where you are populating the table and bind this boolean attribute to the enabled property of your CheckBox.
    and by looping thriugh the table you can check for conditions and based on it set the Enability of the checkbox.
    for (int iRowsCount =0;iRowsCount < wdContext.node<name>().size();iRowsCount++)
    if (condition)
    // Disabling the Checkbox based on the condition
    wdContext.node<name>().get<name>ElementAt(iRowsCount).set<BooleanAttributeName>(false);
    Hope this helps!!
    Cheers,
    Arafat

  • How to disable a Checkbox with condition.

    Dear experts,
    I am doing a module pool program. My questyion is, the program has a checkbox. After certain process, let's say if it met a IF condition. This checkbox needs to be disabled. No matter the checkbox previously is ticked or without tick. The checkbox need to be completely disabled.
    Please advice how should I do it. As I have search in the forum for some time, but I could not get my answer.
    Appreciate if someone can help. Thanks in advance.

    Hi,
    3 problems.
    1. U r using lower case for check boxes screen name
    2. Screen-invisible is used to make data of the parameter invisible while typing eg: PASS WORD.
    3. What ever modification we are doing is over written in AT SELECTION SCREEN OUTPUT event.
    use screen input attribute as i told earlier.
    AT SELECTION SCREEN OUTPUT is analogous to PBO of
    Dialog program
    Check below modified code. It is working fine now.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      tt = 'Example'.
      chk1 = 'X'.
    AT SELECTION-SCREEN OUTPUT.
      IF radio1 EQ 'X'.
        LOOP AT SCREEN.
          CHECK screen-name = 'CHK2'.
          screen-input = 0.
          MODIFY SCREEN.
          EXIT.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          CHECK screen-name = 'CHK1'.
          screen-input = 0.
          MODIFY SCREEN.
          EXIT.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN ON BLOCK b1.
      CASE sy-ucomm.
        WHEN 'R1'.
          IF radio1 = 'X'.
            CLEAR chk2.
            chk1 = 'X'.
          ELSEIF radio2 = 'X'.
            CLEAR chk1.
            chk2 = 'X'.
          ENDIF.
      ENDCASE.
    I hope u r clear now.
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Jul 29, 2008 4:33 PM

  • Read-only radio button or checkboxes save as null

    Hi,
    I have a form with some fields that are editable by 1 group of users and read-only for another group in certain conditions.
    Before the header there is a fetch process to retrieve values from tables. So most fields (read-only & editable) are populated including checkboxes & radio buttons.
    All users can edit at least 1 field on the form.
    When the save button is pressed a PL/SQL process runs to save the data.
    The save works if the field is editable.
    If the field is read-only and text it also works.
    But if the field is a radio button or checkbox a null is saved in the table.
    Any suggestions on how to get the PL/SQL to pick up the read-only radio buttons and checkbox values?

    Hi,
    I had the same problem in my application and I found another solution instead of using two items. I'm using a computation on page processing that makes a select on my table to get the value for the checkbox. I'm doing this with the same condition as my read-only condition on my checkbox item so I can get the database value when it is lose in the submit process.
    Also, I found a difference in the html code between the read-only state of the item and the standard state.
    Original state : name="p_v07" (7 because it's the seventh item on my page)
    Read-only state : name="checkbox"
    I tried to modify this using firebug in execution of the page but without success, the problem is still there.
    Patrick
    Insum Solutions

  • How do I have the learner perform a conditional action based on a button selection?

    The learner needs to select a checkbox on the screen of a performance exercise.  I've put the widget in for the checkbox and it works fine.  After the select the checkbox, they need to select OK on the screen to move them onto the next screen.  However, I don't want the learner to just select OK without selecting the checkbox in order to replicate the sequence correctly. 
    I have a slide which shows the message  which tells them as to what they did wrong when they select OK without checking the box, but when I tie that to the correct response, it will go there whether they select the checkbox or not.
    I've tried adding multiple actions to the button, which doesn't work, becuase the OK button has to be tied to the learner conditionally selecting the checkbox to move on to the correct slide.  If I use multiple actions, and the first action is to SHOW  the slide with the incorrect message, if they correctly check the box and then hit OK, it will first SHOW them the incorrect slide.
    I think what I need is a variable and then add an advanced action with a conditional statement.  However, I don't really know how to do that.  Here's the variable I created, but I don't know what value I should assign.  Here's the screen shot of the variable and conditional statement.  Could someone tell me how to do the variable and the conditional statement so that the learner when selecting OK WITHOUT selecting the checkbox first will be redirected the the error slide and if they select the checkbox FIRST, and then OK, they move on to the next screen?  Thanks,

    Thanks, you definitely got me started on the right track on variables and advanced action statements.  The screen shots helped.
    Here's how the actual fix went to make sure the OK button on the screen had a conditional statement attached to it, with
    an advanced action:
    I created parameters for the widget to link to the variable:
    I created a variable:
    Then I created an advanced action conditional statement for that variable which enabled the button to advance to the next slide when the clickbox was checked:
    Then where I finally realized my final mistake was not setting the button properties to execute advanced action:

Maybe you are looking for