Expand my Community achievements bar.

Date field presence change on click event

Avatar

Level 1

I am trying to get my CurrentDate field (from the Library) to change its presence based on the click event javascript for a radio button.  I think I have everything correct but it is not doing anything.  Following is the javascript for the radio button.  I currently have the CurrentDate field set to invisible.  The form is an 8.0 dynamic form but it needs to render in .pdf format since there will be no server interaction.  I have no javascript experience at all and am trying to figure this out using the LiveCycle help files.  What I am expecting to happen is that when a user opens the form, the CurrentDate field will be invisible until they click on the radio button.  At that time, the field should become visible with the current date in it.  Thanks for any help you may provide.  This is my first time to be using LiveCycle.

Marc

----- form1.#subform[0].RcptVerify.LacklandRadioButton::click: - (JavaScript, client) --------------

if

(LacklandRadioButton.rawValue == true)

LAKdate.presence

= "visible";

else

LAKdate.presence

= "invisible";

----- form1.#subform[0].LAKdate::ready:layout - (FormCalc, client) ---------------------------------

$.rawValue

= Concat(Num2Date(Date(), "YYYY-MM-DD"), " ", Num2Time(Time(), "HH:MM:SS"))

5 Replies

Avatar

Former Community Member

Validate that the field is in fact set to true.....by adding an app.alert(LacklandRadioButton.rawValue) before the if statement. A messageBox shoudl popup with the word true in it. If that is the case true putting your true in quotes ...to make it a string.

Paul

Avatar

Level 1

Thanks Paul.  However, the radio button will not be true until it is clicked on.  I did add the app.alert which did confirm that the button goes true when it is clicked.  Unfortunately, that does not solve the problem of the date field presence needing to change from invisible to visible on that event.

Avatar

Former Community Member

If you put your code on the RadioButtonList Group change object then it wil work as advertised.

Also make sure that you have saved your form as a dynamic form.

Paul

Avatar

Level 1

Thanks Paul!  I was wondering about that.  Will I be able to address the exclusion group as a whole or do I have to address each specific button individually?  Seems like, since this is an exclusion group and only one button would be true at time, I should be able to check the group.  This is what I currently have (which, of course, does not work.  The Javascript Debugger is not a lot of help!  Keeps telling me I have a syntax error.):

----- form1.#subform[0].RcptVerify::change: - (JavaScript, client) ---------------------------------

if

(RcptVerify.members == false);

LAKdate.presence

= "invisible";

else

;

LAKdate.presence

= "visible";

Avatar

Former Community Member

I beg to differ ...the javascript console is telling us you have a problem in the script and you do!

To get the value of an object you need the rawValue property so your first staement shoudl be:

(RcptVerify.members.rawValue  == false);

if