How to use two forms in asp

Reply

Join Date: Apr 2005
Posts: 4
Reputation: ss_asp is an unknown quantity at this point 
Solved Threads: 0
ss_asp ss_asp is offline Offline
Newbie Poster

How to use two forms in asp

 
0
  #1
May 6th, 2005
Hi everybody

Can some one help me out??

My problem is
I am using two forms in my asp page
form1 is used to upload photo, so I used enctype for it and action form1update.asp
and a submit button attached
when clicking on the submit button it should upload file using form1update.asp

form2 consists of 3 text boxes and submit button
action for form2 is form2update.asp
when clicking on submit button in form2, it should update all the details into database using form2update.asp

my problem is whenever i am clicking on upload button (submit button) in form1, instead of action form1update.asp, its going into form2update.asp
can u help me out on this!!!
thanks in advance
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: How to use two forms in asp

 
0
  #2
May 6th, 2005
Can you post an example of the code that is being generated by asp?

I ran into this problem in C#.NET... we had to listen for and disable the enter key event... otherwise it always submitted the wrong form.. but clicking was ok.

cheers.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: How to use two forms in asp

 
0
  #3
May 26th, 2005
in asp and html forms the submit button submits the form that it (the submit button) is in.

you are probably using javascript to submit the form or your second form has a if submit then clause.

post the page for more assistance
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 1
Reputation: rick7069 is an unknown quantity at this point 
Solved Threads: 0
rick7069 rick7069 is offline Offline
Newbie Poster

Re: How to use two forms in asp

 
0
  #4
May 31st, 2005
I hate to jump in here, but I am having a very similar problem and thought maybe someone could, PLEASE, help. I have two forms. The first form is for for user login and has an onSubmit link to validate the fields. When the submit button is hit for this form, it uses the onSubmit link but then proceeds to use the action from the second form. This only happens if the second forms submit button has been used. Here is the code for the first form:

<form method="post" name="FrmLogin" onSubmit="return Validate_FrmLogin()" action="<?php echo $CONST_LINK_ROOT?>/prglogin.php">
<tr>
<td align="left"><?php echo LOGIN_USERNAME?>
</td>
</tr>
<tr>
<td align="left"><input type="text" class="input" name="txtHandle" size="20" tabindex="1" value="<?=$HTTP_COOKIE_VARS[txtHandle_c]?>">
</td>
</tr>
<tr>
<td align="left"><?php echo LOGIN_PASSWORD ?>
</td>
</tr>
<tr>
<td align="left" class="tdeven" > <input name="txtPassword" type="password" class="input" tabindex="2" value="<?=$HTTP_COOKIE_VARS[txtPassword_c]?>" size="20">
</td>
</tr>
<tr>
<td align="left" class="tdodd"><?php echo LOGIN_LOG_AUTOMATICALY ?>
<input type=checkbox name="save"<?php if(isset($HTTP_COOKIE_VARS[txtHandle_c])) echo ' checked' ?>>
</td>
</tr>
<tr >
<td colspan="1" align="left"> <input name="submit" type="submit" class="button" value='<?= BUTTON_LOGIN ?>'>
</td>
</tr>
</form>

and, the code for the second form:
<form name="dating service" method="POST" action="prgminisearch.php">
<tr>
<td height="30" valign="top"><strong>Search for a Date...</strong>
</td>
</tr>
<tr>
<td class="smallest" height="20" valign="bottom"><strong>I am a</strong>
</td>
</tr>
<tr>
<td><select name="lstDatingFrom" size="1" class="inputf">
<option value='M' selected><?php echo GENDER_M?></option>
<option value='F'><?php echo GENDER_W?></option>
<option value='C'><?php echo GENDER_C?></option>
</select>
</td>
</tr>
<tr>
<td class="smallest" height="20" valign="bottom"><strong>Seeking a</strong>
</td>
</tr>
<tr>
<td class="smalltext"><select name="lstDatingTo" size="1" class="inputf">
<option value='M'><?php echo GENDER_M?></option>
<option value='F' selected><?php echo GENDER_W?></option>
<option value='C'><?php echo GENDER_C?></option>
</select>
</td>
</tr>
<tr>
<td class="smallest" height="20" valign="bottom"><strong>Located in</strong>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><select name="lstDatingCountry" class="inputf">
<option selected value="0">
<?=SEARCH_ALLCOUNTRIES?>
</option>
<?while ($country_row = mysql_fetch_object($country_res)){?>
<option value="<?=$country_row->gcn_countryid?>">
<?=$country_row->gcn_name?>
</option>
<?}?>
</select>
</td>
<td><input type="image" src="images/go.gif" style="border:0px solid #ffffff;" width="20" height="21" alt="dating service search" name="dating service search">
</td>
</tr>
</form>

If anyone knows a way around this predicament, please help.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: How to use two forms in asp

 
0
  #5
May 31st, 2005
this is an asp forum i cant understand php.

ok why not put both forms fields on 1 forum? if you need the second form to retrieve a record from the first form put an if then statement

if form1=submit then
form 2
else
form 1
end if

to my knowledge you cant see if a form was submited so you add a url thing similar to "index.asp?login=true" the if is if the url login=true then

hope it helps if not let me know what you hope to achieve, dont expect any php code though
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 27
Reputation: wchitamb is an unknown quantity at this point 
Solved Threads: 0
wchitamb wchitamb is offline Offline
Light Poster
 
0
  #6
Jul 19th, 2005
12345678910
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: How to use two forms in asp

 
0
  #7
Jul 27th, 2005
Originally Posted by wchitamb
12345678910

and the best answer to the problem goes to wchitamb.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 27
Reputation: wchitamb is an unknown quantity at this point 
Solved Threads: 0
wchitamb wchitamb is offline Offline
Light Poster

Re: How to use two forms in asp

 
0
  #8
Jul 27th, 2005
i am sorry man what happened was when i did reply your thread i did an experiment myself and it was not the best solutions so i could't delete it so i just typed the numbers on top.

no hard feelings man!! SORRY ABOUT THAT.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 3
Reputation: paru is an unknown quantity at this point 
Solved Threads: 0
paru paru is offline Offline
Newbie Poster

Re: How to use two forms in asp

 
0
  #9
Aug 2nd, 2005
Hi...
I have tried with my code... which have two forms..
the first form is to upload the page and second if we submit the form it displays the form entries...
Its working fine...
see each submit button have different events..
there is no confusion... unless otherwise it goes to different asp pages...

Thanks and Regards,
UmaParvathy G K
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP Forum
Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC