Question

I was searching for a way to update some variable in the Stripes Action (say it selectedDate) when a user clicks a specific date(lets say 11/15/2011) I wanted selectedDate to be updated (may be by binding the field with the selected day) and the page to be refreshed or displayed again. I might consider using ajax (instead of refreshing the page) for this purpose in the future.

If possible, I would like to create a method (that may return a Resoulution) in the ActionBean to display the page again.

FYI: I couldn't decide between <calendar:calendars> and <tags:calendarWidget>. I will consider the simplest one for now. Give me your recommendation.

Was it helpful?

Solution

If your selectedDate field is on an non Ajax HTML form, then the Stripes Action is only executed when you submit/post the form to the server. If you want this form submit to happen automatically when the selectedDate field is changed, you need to add some Javascript code to your page. For example:

<stripes:text name="selectedDate" onchange="this.form.submit()"/>

In case you use JQuery you might want to checkout:

How to convert onchange="this.form.submit()" to jquery

OTHER TIPS

when date picker would update an html element with the selected date.
call a function on onchange event of that element;
like

<input type="text" value="from date picker" onchange="update_date(this.value);">

function update_date(selecteDate){
if(selectedDate === "11/15/2011")
//do your need
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top