Solved

submit on date selection

Posted on 2004-10-01
7
234 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
7 Comments
 
LVL 9

Expert Comment

by:riyasjef
Comment Utility

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
Comment Utility
You have to change the form "action" to appropriate page
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now