• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

why is my javascript not working after migration

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 26020
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 26020
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.



 
Every plan is a little cooler if you have a blimp. And a tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic