Link to home
Start Free TrialLog in
Avatar of BILL Carlisle
BILL CarlisleFlag for United States of America

asked on

Javascript OnLoad

Hi,

      function setTab(pCurrentTab){
        $('#P6_CUR_TAB').val(pCurrentTab);
      }

      //OnLoad - puts click on Tabs
      $('#ul-PT li a').click(function() {
        setTab(this.id);
      });


// OnLoad -- suppose to click last Tab selected on page load      
      //-------------- Keep track of current tab on submit
      var curTab = '#'+$v('P6_CUR_TAB');
      if( curTab != '#'){
        $(curTab).trigger('click');
        console.log('Trigger['+curTab+']');
      }
      //----


I get the console.log --          Trigger[#a_costBudget_id]

$('#a_costBudget_id').trigger('click'); // when I use this in the console it works..

$('#a_costBudget_id').trigger('click'); // even hard coded this in the onLoad and doesn't work


Any reason this will not work?
Thx, Bill
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Can we see a full listing - or better a link.
Avatar of BILL Carlisle

ASKER

sorry propriatary
ASKER CERTIFIED SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Are you looking for the $(document). ready event by chance?
sorry propriatary
Can you post source?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As I already pointed out, the window 'load' event occurs AFTER the document 'ready' event. You cannot trigger a click event in document 'ready' if you are not registering the click handler until window 'load'. Put the click handler in document 'ready' and the trigger in window 'load'.
Hi All,
Thank you for your responses.
I am using Oracle APEX 4.2.6 dev tool..

To be more clear of what I have:

// In Header
<script type="text/javascript">
var htmldb_delete_message='Would you like to perform this delete action?';
function setTab(pCurrentTab){
  $('#P6_CUR_TAB').val(pCurrentTab);
   console.log('Arg '+pCurrentTab);
   console.log('Item '+ $('#P6_CUR_TAB').val());
}
</script>

$(document).ready(function() {
  $('#ul-PT li a').click(function() {
    setTab(this.id);
  });
  /-------------- Keep track of current tab on submit
  var curTab = '#'+$v('P6_CUR_TAB');
  if( curTab != '#'){
    $(curTab).trigger('click');
    //$('#a_costBudget_id').trigger('click');
    console.log('Trigger['+curTab+']');
  }
});

// In Form
<input type="hidden" name="p_t10" id="P6_CUR_TAB" value="">

What could be in the existing code to prevent this from working?
Like sometimes I need to use !important to override the Oracle APEX CSS
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
my co-worker took it over..

He is using a cookie

thk u for your help..