cancel
Showing results for 
Search instead for 
Did you mean: 

How to match Date Selected from HTML Page to Query Template

former_member331856
Participant
0 Kudos

Hi,

I have created a text field with calendar in HTML Page. if i select a date from the calendar i am getting the Date in the TextBox. i have to match that TextBox Date it to the Query Template Date. Please help me.

Thanks in Advance,

Giridhar

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Giridhar,

By using java scripts you can pass this to query template.

If you want to pass this to query template start dates and End Date

then use [SD] and [ED]

Other wise use the [Param.1] parameters.

Once you textbox is filled with date, on click call a javascript function.

In that function write,

For [SD] & [ED]

document.<appletname>.setStartDate(document.<textboxid>.value)

document.<appletname>.setEndDate(document.<textboxid>.value)

For [Param.1]

document.<appletname>.setParam(1, document.<textboxid>.value)

Hope this will give you an idea about about passing the date to query template.

jcgood25
Active Contributor
0 Kudos

Giridhar,

For clarification on Kishore's post, the proper syntax would be:

For [SD] & [ED]

document.<appletname<b>>.getQueryObject()</b>.setStartDate(document.<textboxid>.value);

document.<appletname><b>.getQueryObject()</b>.setEndDate(document.<textboxid>.value);

For [Param.1]

document.<appletname><b>>.getQueryObject()</b>.setParam(1, document.<textboxid>.value)

The key thing to remember is that the format of the string passed to the StartDate and EndDate query parameters must match the DateFormat parameter of the query template (default: MM/dd/yyyy HH:mm:ss). If the string passed into the dates doesn't match you will get a date parsing error. If the format of the string is passed to [Param.1] then it will be more or less up to the query and data source (Oracle, SQL, etc.) to be forgiving or not.

If you haven't already done so I would recommend making the input text field readonly and control the format through the javascript accessing your calendar object, this way the format needed for the query template can be controlled and will eliminate the manual user typing and then having to attempt to validate the string format in javascript.

Best Regards,

Jeremy Good

Former Member
0 Kudos

Also, make sure you take advantage of the built in xMII date methods that are accessible from the xMII applets (ie, document.myApplet.dateNow()) if needed. It's easy to want to build a whole library of JavaScript methods to perform date handling. It's usually not needed.

Former Member
0 Kudos

Thanks for the correction jeremy. I forgot to mention that.....

regards,

Kishore

former_member331856
Participant
0 Kudos

Thanks for giving reply.

Thanks&Regards,

Giridhar

former_member331856
Participant
0 Kudos

Thanks for giving reply.

Thanks&Regards,

Giridhar

former_member331856
Participant
0 Kudos

Thanks for giving reply.

Thanks&Regards,

Giridhar