By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

How do I submit form data and change to a different page?

P: n/a
Probably a fairly simple problem but one that's been plaguing me for a
couple of days... can anyone help?

I have a classic ASP page with a number of text boxes which are updatable.

For convenience I want to add 'tabs' at the top of the page (like a card
index) as the data to be displayed is split into specific groups (client,
company, preferences, events).

How do I update any changes to the data and switch to a different page - at
the same time? i.e. the user doesn't have to click 'update' (submit button)
before changing pages

Sample code is below...

Thanks in advance
Simon

Sample code:
<table width=785 height="430" border="1" bordercolor="#FFFFCC"
style="border-collapse: collapse"><tr>
<td height="20">
<!-- simple tabs -->
<a href="contacts.asp?id=<% =request("id") %>" >Client details</a>&nbsp;
&nbsp;
<a href="contacts.asp?page=events&id=<% =request("id") %>" >Event
Enquiries</a>&nbsp; &nbsp;
<a href="contacts.asp?page=mailing&id=<% =request("id") %>" >Mailing
Preferences</a>&nbsp; &nbsp;
<a href="contacts.asp?page=company&id=<% =request("id") %>" >Company
Information</a></td></tr><tr>
<td height="410" bgcolor="#FFFFCC" valign="top">
<table border="0" width="785" height="410">
<tr>
<td valign="top" height="390">
<table border="0" width=785>
<tr>
<td>
<!-- start of form -->
<form action=contacts.asp method=post name=form1>
<input type=hidden name=id value=<% =request("id") %>>
<input type=hidden name=page value=<% =request("page") %>>
<input type=hidden name=show value=<% =Request.Cookies("adminshow") %>>
<input type=hidden name=companyid value=<% =oRS("companyid") %>>

<div align="center">
<table border=0 width=782 height=395>
<tr>
<td width="340" valign="top">
<table border="0" width="100%">
<tr>
<td width="100" align="right">title</td>
<td width="10" align="right">&nbsp;</td>
<td width="230"><select size="1" name="title">
<option>-</option>
<option selected><% =oRS("title") %></option>
<option>Mr</option>
<option>Mrs</option>
<option>Miss</option>
<option>Ms</option>
<option>Dr</option>
</select></td>
</tr>
<tr>
<td width="100" align="right">first name</td>
<td width="10" align="right">&nbsp;</td>
<td width="230">
<input type="text" name="name" size="25" value='<% =oRS("name")
%>'></td>
</tr>
....
<!-- more form fields here -->
</table>
</td>
</tr><tr><td colspan="3" height="195">
<p align="center">
<textarea rows="10" name="callbacknote" cols="92"><%
=oRS("callbacknote") %></textarea></td>
</td></tr>
</table>
</div>
</tr>
</table>
</td>
</tr>
<tr><td>
<hr><div align=center>
<a href="index.asp?page=callbacks&show=<% =varID %>">back</a>&nbsp;
<input type="submit" value=" update " name="update">
<input type="button" value=" copy " name="B4"
onclick="recordcopy()">
<input type="button" value=" delete " name="B5"
onclick="recorddelete()">
<input type="button" value=" print " name="B6"
onclick="recordprint()">
</div>

Apr 1 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
....have you thougt about making the tabs to (additional) submit-buttons?! As
far as i can see all tabs are directing to the same page. If this isn't
possible you might consinder using Javascript to modfiy target (and data) of
the form (depeding on the tab clicked) and then using Javascript to simulate
a button click.

ciao, Mike
Apr 1 '07 #2

P: n/a
HI Mike,

Possible I didn't explain myself...

Yes I want to find some javascript (that works unlike mine) that will - from
the onClick property of the HREFs - trigger form submit - I thought it was
myForm.submit() - and then load the alternate page in such a way that it
doesn't matter which link tab has been clicked - I need to store the data
each time a page has been changed as this is the prototype for a large
multi-user system which could have a number of users dependent upon the
data!

Effectively I need a text link which triggers an onClick update of the
database, plus a redirect to the relevant page (actually an include file
within a container) and I've tried all that I can think of without success!

TIA
Simon
"M. Agel" <mi**@eldea.dewrote in message
news:57*************@mid.individual.net...
...have you thougt about making the tabs to (additional) submit-buttons?!
As far as i can see all tabs are directing to the same page. If this isn't
possible you might consinder using Javascript to modfiy target (and data)
of the form (depeding on the tab clicked) and then using Javascript to
simulate a button click.

ciao, Mike
Apr 1 '07 #3

P: n/a
Simon Benson wrote on 01 apr 2007 in
microsoft.public.inetserver.asp.general:
Yes I want to find some javascript (that works unlike mine) that will
- from the onClick property of the HREFs - trigger form submit - I
thought it was myForm.submit() - and then load the alternate page in
such a way that it doesn't matter which link tab has been clicked
What is a link tab?
A tab like in FF or IE7?

What is an "onClick property of the HREFs"?
Do hrefs have onclick properties? I doubt that.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 1 '07 #4

P: n/a

"Simon Benson" <si***********@googlemail.comwrote in message
news:RI****************@newsfe6-gui.ntli.net...
Probably a fairly simple problem but one that's been plaguing me for a
couple of days... can anyone help?

I have a classic ASP page with a number of text boxes which are updatable.

For convenience I want to add 'tabs' at the top of the page (like a card
index) as the data to be displayed is split into specific groups (client,
company, preferences, events).

How do I update any changes to the data and switch to a different page -
at the same time? i.e. the user doesn't have to click 'update' (submit
button) before changing pages

Sample code is below...

Thanks in advance
Simon
1. Use something besides an a[nchor] tag for the tabs, like a button or a
span -- i.e., something for which the built-in click behavior doesn't
implicitly navigate to another document. Most element types support the
onclick event, and all of the anchor element's UI effects (cursor,
roll-over, etc) can be implemented for any element using CSS.

2. Set the action attribute of the form element dynamically in the tab click
procedure, before calling its submit method.

That way the form submit will navigate to the appropriate script, without
any interference from the behavior of an anchor.
-Mark
Sample code:
<table width=785 height="430" border="1" bordercolor="#FFFFCC"
style="border-collapse: collapse"><tr>
<td height="20">
<!-- simple tabs -->
<a href="contacts.asp?id=<% =request("id") %>" >Client details</a>&nbsp;
&nbsp;
<a href="contacts.asp?page=events&id=<% =request("id") %>" >Event
Enquiries</a>&nbsp; &nbsp;
<a href="contacts.asp?page=mailing&id=<% =request("id") %>" >Mailing
Preferences</a>&nbsp; &nbsp;
<a href="contacts.asp?page=company&id=<% =request("id") %>" >Company
Information</a></td></tr><tr>
<td height="410" bgcolor="#FFFFCC" valign="top">
<table border="0" width="785" height="410">
<tr>
<td valign="top" height="390">
<table border="0" width=785>
<tr>
<td>
<!-- start of form -->
<form action=contacts.asp method=post name=form1>
<input type=hidden name=id value=<% =request("id") %>>
<input type=hidden name=page value=<% =request("page") %>>
<input type=hidden name=show value=<% =Request.Cookies("adminshow") %>>
<input type=hidden name=companyid value=<% =oRS("companyid") %>>

<div align="center">
<table border=0 width=782 height=395>
<tr>
<td width="340" valign="top">
<table border="0" width="100%">
<tr>
<td width="100" align="right">title</td>
<td width="10" align="right">&nbsp;</td>
<td width="230"><select size="1" name="title">
<option>-</option>
<option selected><% =oRS("title") %></option>
<option>Mr</option>
<option>Mrs</option>
<option>Miss</option>
<option>Ms</option>
<option>Dr</option>
</select></td>
</tr>
<tr>
<td width="100" align="right">first name</td>
<td width="10" align="right">&nbsp;</td>
<td width="230">
<input type="text" name="name" size="25" value='<% =oRS("name")
%>'></td>
</tr>
...
<!-- more form fields here -->
</table>
</td>
</tr><tr><td colspan="3" height="195">
<p align="center">
<textarea rows="10" name="callbacknote" cols="92"><%
=oRS("callbacknote") %></textarea></td>
</td></tr>
</table>
</div>
</tr>
</table>
</td>
</tr>
<tr><td>
<hr><div align=center>
<a href="index.asp?page=callbacks&show=<% =varID %>">back</a>&nbsp;
<input type="submit" value=" update " name="update">
<input type="button" value=" copy " name="B4"
onclick="recordcopy()">
<input type="button" value=" delete " name="B5"
onclick="recorddelete()">
<input type="button" value=" print " name="B6"
onclick="recordprint()">
</div>

Apr 1 '07 #5

P: n/a

"Simon Benson" <si***********@googlemail.comwrote in message
news:RI****************@newsfe6-gui.ntli.net...
Probably a fairly simple problem but one that's been plaguing me for a
couple of days... can anyone help?

I have a classic ASP page with a number of text boxes which are updatable.

For convenience I want to add 'tabs' at the top of the page (like a card
index) as the data to be displayed is split into specific groups (client,
company, preferences, events).

How do I update any changes to the data and switch to a different page -
at
the same time? i.e. the user doesn't have to click 'update' (submit
button)
before changing pages

Sample code is below...

Thanks in advance
Simon
Are you sure you want to update data when switching between tabs? What
happens of the user doesn't complete filling in stuff on the other tabs?
How does the user indicate they have finished entering their data?

Would it be more preferable simply to let the user navigate between tabs as
they like without submitting any data and have a single submission of the
data when they are happy with it?

Apr 3 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.