Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7934 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have been reviewing the calendar samples need to understand about dynamic buttons.

If I have a layout with a calendar where I can click on a specific date, is there a way to use these button to fill various date fields with different dates...

for example... I have start date and end date fields on a layout and a calendar in the upper corner. Can a user click in the start date field then on the calendar button, that date would populate into the start date... then the user clciks in the end date, then on the same calendar, but a different date, and that date populated the end date..

Maybe there is a different but equal way to accomplish?

thanks

c

Posted

You could have a script like this attached to your button:


If [isEmpty(StartDate)]

  Set Field[startDate, <<the date calculation>>]

Else

  Set Field[EndDate, <<the date calculation>>]

End If





This checks to see if the start date field is empty and if so, sets enters the date there. Otherwise, it puts it in the End Date field. So, you simply click the starting date and then the ending date in that order.



If you have separate buttons for every date, then <<the date calculation>> would simply be the literal date associated with the specific button. On the other hand, if the button is in a portal row, then <<the date calculation>> would be a formula that references the related record and pulls the date in from there. 



If you want the user to specifically click a "Starting Date" button or "Ending Date" button before clicking the calendar button, then you can do this:





#Start Date button script

Set Field[gDateType, "Start"]

#End of  script

.

.

#End Date button script

Set Field[gDateType, "End"]

#End of  script

.

.

#Calendar Button Script

If [gDateType="Start"]

  Set Field[startDate, <<the date calculation>>]

  Set Field[gDateType, ""]

Else

  If [gDateType="End"]

    Set Field[EndDate, <<the date calculation>>]

    Set Field[gDateType, ""]

  End If

Else

  Show Message "Please click the Start Date or End Date button before clicking on a date"

End If

#End of Script

This topic is 7934 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.