Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submitting IFRAME with Form

Status
Not open for further replies.

CrimsonDiva

Programmer
Sep 22, 2000
30
0
0
US
Hi There,

I have a complicated ASP/vbscript/javascript page with an IFRAME in it that doesn't seem to be submitting with the form. Here is a portion of the code:

<SCRIPT LANGUAGE=&quot;javascript&quot;>

function checkForm(){
var theform = document.frmsdnemail;
//Check for the e-mail body
if (theform.mailbody.value==&quot;&quot;){
errorMsg += &quot;\n\t* Please enter a Message for the e-mail&quot;;
} <=== GET A SCRIPT ERROR SAYING THAT theform.mailbody.value IS NULL OR NOT AN OBJECT

</SCRIPT>

<FORM NAME=&quot;frmsendmail&quot; onSubmit=&quot;return checkForm();&quot;>
<TD VALIGN=&quot;top&quot;>
<%
'This bit creates a random number to add to the end of the iframe link as IE will cashe the page
'Randomise the system timer

Randomize Timer
%>
<SCRIPT language=&quot;javascript&quot;>
//Create an iframe and turn on the design mode for it
document.write ('<IFRAME SCROLLING=&quot;yes&quot; SRC=&quot;adv_mail_textbox.asp?ID=<% = CInt(RND * 2000)%> id=&quot;mailbody&quot; WIDTH=&quot;450&quot; HEIGHT=&quot;200&quot; NAME=&quot;mailbody&quot;></iframe>')
frames.mailbody.document.designMode = &quot;On&quot;;
</SCRIPT>
<INPUT TYPE=&quot;submit&quot; NAME=&quot;Submit&quot; VALUE=&quot;Send Myself a Preview&quot; CLASS=&quot;btnSmall&quot;>
</FORM>

CAN SOMEONE TELL ME WHY THIS IS HAPPENING?
Thanks!

 
Thanks Steve,

That doesn't work. I've used theform to represent my form on various occassions so I know that piece is working fine.

Diva
 
try this

document.all.mailbody.value

The other thing to do is have a look at the source code of the output page and make sure that mailbody does actually have a value

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
I noticed you made a type in your code:

var theform = document.frmsdnemail;

should be:

var theform = document.frmsendmail;


That's probably what is causing your problems since it doesn't recognize the object frmsdnemail.

 
Sorry about that. That typo was soley in the message to Tek-Tips. There is no typo in my actual code. [sadeyes]

The big problem here is getting my IFRAME data to pass with my form. It seems like there's no way to do this. I tried document.all.mailbody.value, but I am still unable to actually retrieve the text that was typed into the frame.

I'm trying to create a WYSIWYG E-mail editor. The text in the IFRAME will be used as the body of the e-mail. FOr some reason, I was under the misconception that IFRAMES could be passed with regular FORM elements. This is obviously not the case. Any suggestions? [morning]

<FORM>
<IFRAME></IFRAME>
</FORM>


Diva
 
ahhh...I may have the solution for you then

Are you using Dreamweaver MX?

If so, you should use the HTML editor extension from
It is a fantastic WYSIWYG editor, limited by activeX to IE 5+ and not Netscape.

If you aren't using MX, I would be happy to send you a bunch of pages where I use it soyou can grab teh code, and yes, it does grab the text and i ahve tweaked it to update a database.

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
[green]document.write ('<IFRAME SCROLLING=&quot;yes&quot; SRC=&quot;adv_mail_textbox.asp?ID=<% = CInt(RND * 2000)%>[red]&quot;[/red] id=&quot;mailbody&quot; WIDTH=&quot;450&quot; HEIGHT=&quot;200&quot; NAME=&quot;mailbody&quot;></iframe>')[/green]


that for starters is missing a close dblquote

i also know that java is case sensitive .. perhaps the &quot;On&quot; should be &quot;on&quot; or perhaps true?

also the form requests a return onsubmit, but checkForm returns no values.

might also want to do an alert(theform); after the var assignment (where the comment is in the form validator) make sure that theform has been assigned as an object properly instead of a text variable the alert should return &quot;[object]&quot;

after trying those, let us know if there's futher issues, and if there's different errors.

hope the info helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top