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

problem in javascript form submission with mozilla

P: 4
I m using a form which is posted through javascript on click of a image.Its working fine in IE but not in mozilla.
can anybody help me out?

my code is



Expand|Select|Wrap|Line Numbers
  1.  print("<form name=\"topPanelForm\" id=\"topPanelForm\" method=\"post\">");     
  2.                      print("<input type=\"hidden\" name=\"sid\" id=\"sid\" value=\"" . $sid . "\">");
  3.                      print("<input type=\"hidden\" name=\"catid\" id=\"catid\" value=\"".$categoryId."\" >");
  4.                      print("<input type=\"hidden\" name=\"subcatid\" id=\"subcatid\" value=\"".$subcategoryId."\" >");
  5.                      print("<input type=\"hidden\" name=\"tabval\" id=\"tabval\" value=\"\" >");
  6.                      print("<input type=\"hidden\" name=\"server_root\" id=\"server_root\" value=\"".$server_root."\" >");
  7.                         print("</form>");
  8.  
  9.  
  10.  
  11.  <input type="image" src=<?php print("\"" . $imgpath . "personal_finance_btn_over.gif\""); ?> name="Personal_fin" width="139" height="34" border="0" id="Personal_finance" value="1:Personal_finance" onclick="setCategory(this.value);" />
  12.  
  13.  
  14.  
  15. function setCategory(cateid)
  16. {    usid=document.topPanelForm.sid.value;
  17.     server_root=document.topPanelForm.server_root.value;
  18.  
  19.     category=cateid.split(":",2);
  20.     cat=category[0];
  21.         id=category[1];
  22.         subcatgid=cat+"01";
  23.         document.topPanelForm.action=server_root+"/login/community.php";
  24.         document.topPanelForm.catid.value=cat;
  25.         document.topPanelForm.subcatid.value=subcatgid;
  26.         document.topPanelForm.tabval.value=cat;
  27.         alert("sid  "+document.topPanelForm.sid.value)
  28.  
  29.           //document.topPanelForm.submit();
  30.         document.getElementById("topPanelForm").submit();
Nov 12 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Instead of a mixture of PHP/HTML, show the client-side version.

Your input field is outside the form.
Nov 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.