Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

function chkFormular by guest_username

Quote Reply
function chkFormular by guest_username
 
Hello

I want to check the field guest_username in
the template include_post_common_write.html


Code:
<script type="text/javascript">
<!--
function chkFormular()
{
if(document.post.guest_username.value == "") {
alert("Please enter your Name!");
document.post.guest_username.focus();
return false;
}
// -->
</script>

or

Code:
<input type=hidden name="required" value="guest_username">

But is dosent work in

include_post_common_write.html

What must i do ?


mfg hoefti
linktobuy Web Directory
Ratgeber Recht

Last edited by:

hoefti: Oct 5, 2002, 2:33 AM
Quote Reply
Re: [hoefti] function chkFormular by guest_username In reply to
Hi heofti,

Are you sure the javascript doesn't work? Take a look at some of the Javascript form validators around - but you'll probably want to put them in the post_write.html and post_reply_write.html templates, since that is where the <form> ... </form> tags are.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] function chkFormular by guest_username In reply to
Hello Jagermann

It dosent work
My script ist not working even
<script language="JavaScript">
<!--
document.post.guest_username.focus();
// -->
</script>
dosent work

i put it on the same place where
<script language="JavaScript">
<!--
document.post.post_subject.focus();
// -->
</script>
are.

i want to prevent that Guest are posting with the same Name

Please help me
Thanks
mfg hoefti
linktobuy Web Directory
Ratgeber Recht
Quote Reply
Re: [hoefti] function chkFormular by guest_username In reply to
Hi hoefti,

I haven't checked this Javascript, but try something along these lines:

In the post_write.html template, look for the <form> tag. Add to it:

<%if post_guest_custom_username%> onsubmit="if (document.post.guest_username = '') { return false; } return true;"

You'll also need to make the same change to post_reply_write.html. You'll probably also want to put an "alert" in there telling them to enter a username and the "document.post.guest_username.focus()". Both should be before the "return false;".

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] function chkFormular by guest_username In reply to
Hello Jagerman

Sorry, but it dosent works

In post_reply_write.html i add
after
Code:
<%if advanced_editor and is_ie and ie_version >= 5.5%>
<%include include_post_html_common_write_antwort.html%>
<%elsif current_user_advanced_editor and not basic_editor and is_ie and ie_version >= 5.5%>
<%include include_post_html_common_write_antwort.html%>
<%else%>
<%include include_post_common_write_antwort.html%>
<%endif%>

<script language="JavaScript">
<!--
<%if post_guest_custom_username%> onsubmit="if (document.post.guest_username = '') { return false; } return true;"
<%endif%>
// -->
</script>

I hope you can checked the Funktion in the next Time and give me a exact instruction to make this possible

Thnaks vor your help

mfg hoefti
linktobuy Web Directory
Ratgeber Recht