• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why is my javascript not working after migration

 
jyothi nalam
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a radio button and a rich:calendar component. on select of a radio button the rich:calendar need to be updated.
We are migrating our application from richfaces 3.3 to richfaces 4, jsf 1.2 to jsf 2.
Following is my code that worked fine before migration.



Please help. i could not figure out what is wrong since i am new to jsf and richfaces and also not good with javascript.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not actually sure about the validity of the "render()" javascript function, but that's not something I usually do, since I've always used the a4j:support method to supply dynamic re-rendering. In RF4, that would probably mean adding an "f:ajax" sub-element to your radio button. And, as a general rule, I've found it simpler and safer to let AJAX update the Model (backing bean) and then re-render the control from the model than to meddle with the control values on the page.

Incidentally, the "language="javascript"" attribute on the script tag is deprecated as of HTML5.
 
jyothi nalam
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:I'm not actually sure about the validity of the "render()" javascript function, but that's not something I usually do, since I've always used the a4j:support method to supply dynamic re-rendering. In RF4, that would probably mean adding an "f:ajax" sub-element to your radio button. And, as a general rule, I've found it simpler and safer to let AJAX update the Model (backing bean) and then re-render the control from the model than to meddle with the control values on the page.

Incidentally, the "language="javascript"" attribute on the script tag is deprecated as of HTML5.


Thanks a lot for the reply Tim.

My application has two options. we can select the date range either through the radio buttons which have 30days(default), 60days etc options or directly set the date from the rich:calendar component.

When I have tried with ajax and backing bean, the radio buttons work fine and update the calendar dates. Following is my code:

But I am failing the other way, I could not set the calender directly, because when i click the search, the dates are reset to the dates selected by the radio button.

Please suggest. The examples that I saw online does not give much details about the javascript functions of the calendar component.

Thanks in advance.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm at a loss, myself. I switched to the RichFaces calendar years ago. Tomahawk was fairly new when I used it, and back then I got scalped regularly.
 
jyothi nalam
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it resolved. In my code previously, the setPoSelectedDateRange method assigns value to the dateTo and dateFrom calendar components. So this method is always called before submitting the search. So I separated the logic to set the calendar components and called that from the listener.

This is how, I was doing.


so poDatePlacedRange is just a setter which sets the variable poDatePlacedRange. and the listener method is the one that gets called whenever there is a change in radio button select.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic