Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2004, 11:17 AM   PM User | #1
xiaodao
Regular Coder

 
Join Date: Sep 2004
Posts: 713
Thanks: 6
Thanked 2 Times in 2 Posts
xiaodao is an unknown quantity at this point
anything wrong with this script

Code:
function gosubmit(address) {
var address;
document.myformname.action=address;
document.myformname.submit();
return true;
}
</script>
because i want to create something that can submit to different url address in same form using text links, am i correct this way?
__________________
flying dagger
xiaodao is offline   Reply With Quote
Old 12-24-2004, 03:04 PM   PM User | #2
Bobo
Regular Coder

 
Join Date: Jan 2004
Location: Port Huron, MI, U.S.A.
Posts: 280
Thanks: 0
Thanked 0 Times in 0 Posts
Bobo is an unknown quantity at this point
I don't think your supposed to have "var address" and address as an arguement, so get rid of the "var address" line. Otherwise fine, I think.
__________________
Oh, was I supposed to put something here? ........
Bobo is offline   Reply With Quote
Old 12-25-2004, 01:53 AM   PM User | #3
xiaodao
Regular Coder

 
Join Date: Sep 2004
Posts: 713
Thanks: 6
Thanked 2 Times in 2 Posts
xiaodao is an unknown quantity at this point
it is not working, strange, i dont know why please help
__________________
flying dagger
xiaodao is offline   Reply With Quote
Old 12-25-2004, 03:44 AM   PM User | #4
Bobo
Regular Coder

 
Join Date: Jan 2004
Location: Port Huron, MI, U.S.A.
Posts: 280
Thanks: 0
Thanked 0 Times in 0 Posts
Bobo is an unknown quantity at this point
Let ~me see the code that executes the function and the code for the form itself.
__________________
Oh, was I supposed to put something here? ........
Bobo is offline   Reply With Quote
Old 12-25-2004, 06:35 AM   PM User | #5
xiaodao
Regular Coder

 
Join Date: Sep 2004
Posts: 713
Thanks: 6
Thanked 2 Times in 2 Posts
xiaodao is an unknown quantity at this point
Code:
<script language="javascript">
function gosubmit(address) {
document.approvearticle.action=address;
document.approvearticle.submit();
return true;
}
</script>
<form name=approvearticle>
$sql=mysql_query("SELECT * FROM pa_article WHERE status=0");
while ($row=mysql_fetch_array($sql)) {
	echo "<tr bgcolor=#f5f5f5 align=center><td><input type=\"hidden\" name=\"rowid\" value=\"".$row[id]."\"><input type=\"text\" name=\"title\" value=\"".$row['title']."\"></td><td><input type=text size=5 name=bookid value=".$row['bookid']."></td><td><input type=text name=chapterid size=5 value=".$row['chapterid']."></td>";
	echo "<td><a href=\"javascript:gosubmit(approvearticle.php?action=update);\">update</a<a href=\"javascript:gosubmit(approvearticle.php?action=preview);\">preview</a>&nbsp;<a href=\"javascript:gosubmit(approvearticle.php?action=approve);\">approve</a></td></tr>";
}
?>
thanks
__________________
flying dagger
xiaodao is offline   Reply With Quote
Old 12-25-2004, 10:57 AM   PM User | #6
dumpfi
Regular Coder

 
Join Date: Jun 2004
Posts: 565
Thanks: 0
Thanked 18 Times in 18 Posts
dumpfi will become famous soon enough
This should work:
Code:
<script type="text/javascript">
function gosubmit(address) {
  document.approvearticle.action=address;
  document.approvearticle.submit();
  return true;
}
</script>
<form name="approvearticle">
<table>
$sql = mysql_query('SELECT `id`, `title`, `bookid`, `chapterid` FROM `pa_article` WHERE `status` = 0');
while ($row = mysql_fetch_assoc($sql)) {
	echo '<tr style="background-color:#f5f5f5" align="center"><td><input type="hidden" name="rowid" value="'.$row['id'].'"><input type="text" name="title" value="'.$row['title'].'"></td><td><input type="text" size="5" name="bookid" value="'.$row['bookid'].'"></td><td><input type="text" name="chapterid" size="5" value="'.$row['chapterid'].'"></td>';
	echo '<td><a href="javascript:gosubmit(\'approvearticle.php?action=update\');">update</a><a href="javascript:gosubmit(\'approvearticle.php?action=preview\');">preview</a>&nbsp;<a href="javascript:gosubmit(\'approvearticle.php?action=approve\');">approve</a></td></tr>';
}
?>
</table>
</form>
dumpfi

Last edited by dumpfi; 12-25-2004 at 11:02 AM..
dumpfi is offline   Reply With Quote
Old 12-25-2004, 11:30 AM   PM User | #7
xiaodao
Regular Coder

 
Join Date: Sep 2004
Posts: 713
Thanks: 6
Thanked 2 Times in 2 Posts
xiaodao is an unknown quantity at this point
thanks, problem solved
__________________
flying dagger
xiaodao is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:24 PM.


Advertisement
Log in to turn off these ads.