This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 9, 2015, 1:50 AM
1 Posts

onclick event

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4

Ok this seemed to me to be a very simple question, but not sure why I am struggling with this. 

I have a radio button, basically all I want to do is show the user his address, and post the radio button "is this the right address?"

If they say yes, then that's great. If no, then I want to render a panel where they can enter new address.

I created the panels and have the newAddress as rendered false property. But for the life of me, I can't figure out why the radio button onclick event is not working. I click yes/no, and nothing gets fired. 

What should I do to trap an event on the radio button to be able to hide/show the newAddress panel?

Any help is appreciated. I tried client and server side javascript and cant get what seems to be simple working.

Thanks.

Aug 9, 2015, 8:54 AM
22 Posts
code

It's very difficult to help if you haven't posted the code - please add it so we can see what you are doing :o) Thx

Aug 9, 2015, 11:24 PM
453 Posts
With out the code I'm guessing a bit but .....

On a radio button I would probably put the action on the onChange event rather than the click. You would have to check the firing order but I wonder if the value is not changed until after the onClick event so your code executes too soon. I have not tested this but it would not be hard to do some out put to the console on each of the events. 

I know that at one point I tried some code in the onClick event of a combo box which did not work very well, changed it to the onChange event and it did what I wanted.

Aug 10, 2015, 12:10 PM
586 Posts
Why Radio Buttons?

Well of course we should be able to make the radio button work....

But are you using the radio button for the "yes" "no" bit?

I typically don't see or use this pattern myself.  I see Radio buttons more for different "states" of a record.

In you're case I'd throw the text out:

"Is this the right address?"

And then have actual butttons or links styled as buttons for the "Yes" and "No".  Since you want to re-render something from the event itself I think buttons/links work better in this case.

(Of course that's just an opinion and I've not seen the rest of the app)..

 

Good Luck

Dave

Aug 10, 2015, 3:16 PM
453 Posts
Further to David's point

I have used a single CheckBox but always have looked at the onChange event not the click to do something along the line that you are doing, and I believe that the checkBox is a bit more intuitive, however, having said that I see no reason why the single radio button would not work the way that you want it to. I will set up a little test case but I really think the issue is that you should be checking the value in the onChange event not the onClick.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal