Solved

submit on date selection

Posted on 2004-10-01
7
237 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
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 200 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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-…
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…

803 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