Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Javascript Question
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

redbrad0
Advanced Member

USA
3725 Posts

Posted - 26 June 2001 :  13:47:21  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I have a hidden input field that when the preview button is clicked, i want it to set the value of the hidden field to something different. here is the example....


<SCRIPT LANGUAGE="JavaScript">
function CreatePreview(){
document.PostCode.Preview.value="yes";
document.PostCode.submit();
}
</script>

<form action="segments_admin.asp" method="post" name="PostCode">
<input type="hidden" name="Preview" value="no">
<input name="Preview" type="button" value=" Preview " onclick="CreatePreview()">
</form>


it submits the form fine, but does not change the value, any ideas?

Brad

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 26 June 2001 :  14:17:13  Show Profile  Visit HuwR's Homepage
trying changing the name of your form element to something other than Preview

Go to Top of Page

tilttek
Junior Member

Canada
333 Posts

Posted - 26 June 2001 :  15:03:49  Show Profile  Visit tilttek's Homepage
quote:

I have a hidden input field that when the preview button is clicked, i want it to set the value of the hidden field to something different. here is the example....

<SCRIPT LANGUAGE="JavaScript">
function CreatePreview(){
document.PostCode.Preview.value="yes";
document.PostCode.submit();
}
</script>
<form action="segments_admin.asp" method="post" name="PostCode">
<input type="hidden" name="Preview" value="no">
<input name="Preview" type="button" value=" Preview " onclick="CreatePreview()">
</form>




Hum, there is a bug with NS4.x so try using this instead:


<SCRIPT LANGUAGE="JavaScript">
function CreatePreview(){
document.PostCode.Preview.value="yes";
setTimeout("document.PostCode.submit()", 10);
}
</script>
<form action="segments_admin.asp" method="post" name="PostCode">
<input type="hidden" name="Preview" value="no">
<input name="PreviewButton" type="button" value=" Preview " onclick="CreatePreview()">
</form>


And you hade two object with the same name!

Philippe Gamache
http://www.tilttek.com
http://www.lapageamelkor.com
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 26 June 2001 :  15:25:07  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
thanks, it worked GREAT

Brad
Go to Top of Page

tilttek
Junior Member

Canada
333 Posts

Posted - 27 June 2001 :  09:58:51  Show Profile  Visit tilttek's Homepage
quote:

thanks, it worked GREAT



Never forget to use the SetTimeout, cause of a bug in Netscape.

Philippe Gamache
http://www.tilttek.com
http://www.lapageamelkor.com
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 27 June 2001 :  10:07:45  Show Profile  Visit HuwR's Homepage
quote:

quote:

thanks, it worked GREAT



Never forget to use the SetTimeout, cause of a bug in Netscape.

Philippe Gamache
http://www.tilttek.com
http://www.lapageamelkor.com



Is this something we should therfore fix in the Snitzcode, there are quite a few uses of the javascript submit function

Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 27 June 2001 :  10:58:35  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
is the 10 the amount of seconds to wait before submiting?
setTimeout("document.PostCode.submit()", 10);

should it be set to 1 instead?
setTimeout("document.PostCode.submit()", 1);
quote:

quote:

thanks, it worked GREAT



Never forget to use the SetTimeout, cause of a bug in Netscape.

Philippe Gamache
http://www.tilttek.com
http://www.lapageamelkor.com



Brad
Go to Top of Page

tilttek
Junior Member

Canada
333 Posts

Posted - 28 June 2001 :  08:58:52  Show Profile  Visit tilttek's Homepage
quote:

is the 10 the amount of seconds to wait before submiting?
setTimeout("document.PostCode.submit()", 10);
should it be set to 1 instead?
setTimeout("document.PostCode.submit()", 1);



No 10 seconds would be 10000... It's Millisecond.


Philippe Gamache
http://www.tilttek.com
http://www.lapageamelkor.com
Go to Top of Page

big brother
Starting Member

27 Posts

Posted - 28 June 2001 :  09:28:43  Show Profile
Alternately you could always try this!

<SCRIPT LANGUAGE="JavaScript">
function CreatePreview(){
document.PostCode.Preview.value="yes";
document.PostCode.submit();
}
</script>

<form action="segments_admin.asp" method="post" name="PostCode">
<input type="hidden" name="Preview" value="no">
<a href="javascript:CreatePreview();">preview</a>
</form>

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.39 seconds. Powered By: Snitz Forums 2000 Version 3.4.07