[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

submit on date selection

Posted on 2004-10-01
7
Medium Priority
?
248 Views
Last Modified: 2008-02-01
I am using java script for date picker.  What I would like to happen is that when the date is selected, instead of just passing the new date back to the form, I would like for it to continue on to a new page where that date has been passed as a variable.  i

Here is the code that I am using on my asp page for the date picker.

  <tr>
    <td width="12" background="steel.gif"><font face="Tahoma" size="2"><img border="0" src="l_32.gif" width="12" height="32"></font></td>
    <td width="448" background="steel.gif" colspan="4"><font face="Tahoma" size="2">When will this start?</font>
      <FORM NAME=DATE1 ><INPUT type=text name=date1 value='<%=right("0" & Month(Date()),2) & "/" & right("0" & Day(Date()),2) & "/" & Year(Date())%>'
                      onchange="javascript:cbfloadmefirst('form1', 'date1');" size="20">
      <INPUT id=btn1 type=button value='Calendar' onclick="javascript:cbfshowcalendar('FMLFOR', 'date1', 'btn1');event.cancelBubble=true;">
   </FORM>
    </td>
    <td width="448" background="../images/2004/bg_steel.gif" colspan="4"><font face="Tahoma" size="2">
   </tr>
0
Comment
Question by:Chuck_aa
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:riyasjef
ID: 12204084

change the code


<INPUT id=btn1 type=button value='Calendar' onclick="javascript:cbfshowcalendar('FMLFOR', 'date1', 'btn1');event.cancelBubble=true;">

to


<INPUT id=btn1 type=button value='Calendar' onclick="javascript:cbfshowcalendar('FMLFOR', 'date1', 'btn1');event.cancelBubble=true;this.form.submit();">

Riyasjef

0
 
LVL 9

Expert Comment

by:riyasjef
ID: 12204187
You have to change the form "action" to appropriate page
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 800 total points
ID: 12204211
Use this extended function:

function cbfselectdate(objid)
{
     var tmpobj;
     var d=eval("document.all." + objid + ".value");
     var m=parent.document.frames.CalFrame.document.fx.txtmth.value;
     var y=parent.document.frames.CalFrame.document.fx.txtyrs.value;
     var objname=parent.document.frames.CalFrame.document.fx.txtobj.value;
     var frmname=parent.document.frames.CalFrame.document.fx.txtfrm.value;
     
     if (d!="")
     {
     cbfdrawcalendar(d,m,y);
     parent.document.frames.CalFrame.document.fx.txtday.value=d;
     
     tmpobj=eval("parent.document." + frmname + "." + objname);
     newdate=m+"/"+d+"/"+y;
     tmpobj.value=newdate;
     
     parent.document.all.CalFrame.style.display="none";
     parent.document[frmname].submit();  // this line added
     }
}

0
 

Author Comment

by:Chuck_aa
ID: 12204589
Zvonko!  You are brilliant!!!!!!!!!!!!!  but ofcourse I have another question for you....  so I added that line to the code and it brought me back to the page with the date selected.... but where do I enter the page that I want it to go to and the additional variables?
0
 

Author Comment

by:Chuck_aa
ID: 12204614
I do want it to go back to the same page... but I need to add on to the query string a few more variables....
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question