• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

javascript/jsp question

Munashiimaru

Junior Member
So I have a page that has tabs, and I want to disable enter on one of the subpages. I have a javascript function that'll do it, but it doesn't get seen if I put it in the subpage. I needed to move it to the main page to get it to work, but I specifically don't want it disabling one of the other subpages. I assume there's some way to distinguish which page I'm on, but I suck with javascript and don't know where to begin.

Code:
In main JSP (search.jsp):
[COLOR=black]<script>[/COLOR]
[COLOR=black]  document.onkeypress = stopRkey[/COLOR]
[COLOR=black]</script>[/COLOR]
 
[COLOR=black]in JS File:[/COLOR]
 
[COLOR=black]function stopRkey(evt) {[/COLOR]
[COLOR=black]  var evt = (evt) ? evt : ((evt.srcElement) ? evt.srcElement : null);[/COLOR]
[COLOR=black]  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);[/COLOR]
[COLOR=black]  if (( evt.keyCode == 13) && (node.type == "text")){[/COLOR]
[COLOR=black]      return false;[/COLOR]
[COLOR=black]  }[/COLOR]
[COLOR=black]}[/COLOR]
searchform.jspf and editserver.jsp are the two subpages if that helps. Any help appreciated ^.^
 
How are the tabs loaded? AJAX? Or at least JavaScript? Perhaps you should put the return stopping code in the page selection code. You'll probably need return-allowing code as well in that case, in case the user goes back and forth between the two tabs you mentioned.
 
How are the tabs loaded? AJAX? Or at least JavaScript? Perhaps you should put the return stopping code in the page selection code. You'll probably need return-allowing code as well in that case, in case the user goes back and forth between the two tabs you mentioned.

A wizard did that partcular part of the code so I'm not sure : ( but it's a good place to look. I was hoping there was a variable or something stuck in the event I could check in the mainpage/function.

The inital loading of the tabs is done with javascript. I don't know where switching between tabs manually is handled probably something similar
 
Last edited:
The final version does a check on enter key press to see if the div the tab pages mess with is set to a display style.

if (document.getElementById("detailsArea").style.display == "block") { (code I wrote in previous post) }

Took a while to figure out what exactly the tab code was doing to the page. It's using the dynamic drive javascript library.
 
Back
Top