[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Dynamic Form Submit/IFrame Display Problem

Hi Guys,
I have a dynamic form on my "VBSCRIPT" ASP page i have two problems..

- Problem 1 -
when the user selects their class from the list i want the form to post automactily...this works fine in Internet Explorer but in Netscape, Firefox and Opera it doesnt submit.... here is the code i am using for the form submit...

<script type="text/javascript">
<!--
function submitform()
{
       // submit the form
       document.forms("selectmyclass").submit();
}
-->
</script>


<form NAME="selectmyclass" action="classroster.asp" method="post">
      <select name="frmselectmyclass" onChange="submitform();">
        <option value="">Select Your Class
        <option value="1a">Class 1a</option>
        <option value="1b">Class 1b</option>
        <option value="1c">Class 1c </option>      
        </select>
          </form>

ive have my code live here ... http://www.eireweb.com/webforms/ basically i need the form to submit for all types of browsers...


- Problem 2 -
I have a fair few forms on the site and i dont want the user to see the names of these forms in the browser so i am I am using an IFRAME on my site to display the different forms.....in internet explorer it looks fine... but in Netscape, Firefox and Opera the frame looks really really squashed...


any ideas on how to fix this two proboblems please?
Thanks
Jay Eire
(<>..<>)
0
jay_eire
Asked:
jay_eire
1 Solution
 
eyeh8uCommented:
This fixes your submitter:

<script type="text/javascript">
<!--
function submitform()
{
       // submit the form
       document.forms.selectmyclass.submit();
}
-->
</script>


And this fixes your iframe size:
<html>
<head>
<title>:: Class Test ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="800" height="100%" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#000066">
  <tr>
    <td height="30"><h1><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">EIRE WEB</font></h1></td>
  </tr>

  <tr>
    <td bgcolor="#FFFFFF"><iframe src="http://www.eireweb.com/webforms/form1.asp" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe></td>
  </tr>
</table>
</body>
</html>


The syntax document.forms("formname") is not standard, it's an IE only feature. I think document.forms["forname"] would also work, but I tend to use document.forms.formname myself as I know it always works. Note it's case sensitive.

AS for your iframe, it's height was set to be 100% of the div, which didn't have a fixed height. You could add style="margin-left:auto;margin-right:auto;" to your iframe to centre it, but since it's width 100, that's pretty much a waste of time.
0
 
jay_eireAuthor Commented:
excellent works a treat! thanks mate.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now