Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Apex 18.1 using Checkboxes in a tree

3758340Aug 8 2018 — edited Aug 13 2018

Good afternoon.

I have a question about the new tree region (with Checkboxes) in Apex 18.1 :

I would like that, when I select a node, also all its ancestors are selected. I have tried but I am not able to do this.

Is it possible or is this function not foreseen?

Thanks.

Best regards.

Cinzia

This post has been answered by unknown-851512 on Aug 10 2018
Jump to Answer

Comments

794254
I agree with your second point, depending on JavaScript is a bad idea.

And you're right about the fact that you'll need to hard code the text of the button. I've used this way myself and it's prone to quite a few bugs, like extra spaces etc.

I really can't think of another way but I could maybe help you out with the comparison and button names. How about going the Struts way and using resource bundles? That way, you only work with the keys and the values ( your button's text) stays out of the code.

And you don't have to use Struts since the JSPs display will be done with the JSTL <fmt> tags. But you will have to work on reading your properties file and making some sort of Map from the key/ values in your servlet that does the comparison.

----------------------------------------------------------------
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
----------------------------------------------------------------
843840
Thanks for your suggestion.

I read something about using Struts this way but.... don't take me the wrong way... I watched a presentation about Struts and it seems to me that it is more complicated than helpful and it won't even be taken as pattern by Sun for Java as JSF.

Actually I really want to stay between JSTL, JSF and JEE

Best Regards,
Olivier Voutat
843840
Oh, sorry, bad reading. Resource bundles... hmm, will evaluate that idea.

Best Regards,
Olivier Voutat
794254
It seem rather convoluted at first but it's really good. I've not worked with JSF so I've no idea how that compares but from what I know, Craig McClanahan, who came up with Struts, worked on JSF also, so I guess it could only improve on Struts.

EDIT: Here's a search result on Google'ing his name: http://www.theserverside.com/news/thread.tss?thread_id=29068

But like I said, you don't have to use Struts ( which only uses standard JSP/ Servlets stuff anyway ), you simply use one of the ideas from it.

For example; you have a properties file, say "/WEB-INF/properties/myProps.properties" with these entries:
#USERS MODULE
users.button.save=Save User
users.button.search=Search User By Name
users.button.delete=Delete User
This would be a key: users.button.save to the value Save User

Now, in your JSP, you use JSTL <fmt> tags:
<fmt:setBundle basename="properties.myProps"/>
//set the resource bundle you want to use

//and create buttons with the proper values
<input name="myButton" type="submit"><fmt:message key="users.button.save"/></input>
<input name="myButton" type="submit"><fmt:message key="users.button.search"/></input>
This would create buttons with text "Save User" and "Search User By Name" respectively

Now, finally, in your servlet:
//create a map of the properties, 
//possibly on app startup using a ServletContextListener 
//and put it in the servlet context for access everywhere

HashMap myProps = (HashMap)getServletContext.getAttribute("myPropertiesMap");

String buttonClicked = request.getParameter("myButton");

if ( buttonClicked.equals((String)myProps.get("users.button.save")) )
{
 //perform save action
}
else if ( buttonClicked.equals((String)myProps.get("users.button.search")) )
{
 //perform search action
}
//etc
You'll obviously want to optimize this. Perhaps make a method that handles the comparison so you can have neater if conditions. But you get the idea, right?

Edited by: nogoodatcoding on Oct 4, 2007 8:12 PM
843840
Yeah, I got the idea. Thanks.

Best Regards,
Olivier Voutat
794117
Just a caveat on this approach.
It will work fine for input type="submit"
It will NOT work for input type="image" (an image submit button) on Internet Explorer.

When you click on an <input type="image" name="pushme"/> the parameters that actually get submitted are pushme.x and pushme.y, giving the x,y co-ordinates of where you clicked on the button. It does NOT submit a value (if one exists)

Firefox does. Not sure about IE7.

Anyway, the obvious workaround is rather than giving buttons the same name, and switching on the value, instead give the buttons different names, and look for that parametername (or parametername.x) in the request parameters.
That approach would also let you put whatever value you like on the button

Cheers,
evnafets
843840
humm, interesting info and I have another one for you. Use the submit buttons and change the appearance using CSS. You can even put an image instead of the regular button with background-image property.

Best regards,
Olivier Voutat
843840
The background-image property doesn't do some magic to turn an input type="submit" into an input type="image" element. So you're safe with that.
843840
I have a specific question regarding LookupDispatchAction - this is for a HTML form that has multiple submit buttons. ButtonA executes a search based on the various field inputs in the form. ButtonB saves the input criteria to the database with name specified in a "searchName" input field on the same form. Now, I will create the mapping so that one action performs the search and another action that saves the search input to the database.

I am confused about validation though (I am not using the validator framework yet) - when I click on ButtonA, I want all the fields to be validated with the exception of "searchName" before the corresponding, subsequent action (search) is performed.When I click on ButtonB, I want to validate only the "searchName" field before the corresponding, subsequent action (save) is performed. I am currently performing all field validations in the ActionForm's validate method. But I don't know how to validate only the "searchName" field when the Save button is clicked.

-webuser7
1 - 9
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 10 2018
Added on Aug 8 2018
8 comments
1,682 views