Disable button programmatically in oracle apex using javascript/jQuery
I'm trying to disable a button inside of a form region in Oracle Application Express (Apex v3) in an ajax-ified manner. I'm using jQuery to accomplish the ajax part.
$('#P16_MYBUTTON').hide();
Doing a view source on the rendered page I noticed that the button doesn't have an ID even though in Apex I've given it a name. I scanned thro开发者_开发百科ugh the rest of the code and noticed that other elements do have an ID. This behavior is somewhat confusing to me.
Any ideas?
Apex 4.0 does assign an ID to each button automatically. In Apex 3.x you can assign one yourself via the button's Attributes property:
id="P16_MYBUTTON"
If the button is an HTML button then that is sufficient to make it work; if the button is based on a template then you need to ensure that the template definition contains the #BUTTON_ATTRIBUTES# substitution string in an appropriate position - for example:
<a class="myButton" href="#LINK#" #BUTTON_ATTRIBUTES#>#LABEL#</a>
I don't know how Apex does its rendering thing, however, you could use another JQuery selector to locate the button, for instance, if you know the ID or html tag name of the direct parent of this button you could use something like:
$('form > button:first').hide()
For future reference, download this refcard:
http://refcardz.dzone.com/refcardz/jquery-selectors
精彩评论