Adding a Button to My Web (Password)

J

JCO

I want to add a simple Form Field & Push Button so that when selected, will
validate
a field to allow the user to go to the next page or not. Nothing fancy.

I created a separate htm page with a form field:

How do you verify the field (when the button is selected)?
How do you, programmatically with JavaScript's, open the next page or
display a blank page.

Any help on this code (script) is appreciate.
 
J

Jim Buyens

-----Original Message-----
I want to add a simple Form Field & Push Button so that
when selected, will validate a field to allow the user to
go to the next page or not. Nothing fancy.

I created a separate htm page with a form field:

How do you verify the field (when the button is selected)?

First, make sure the button is truly a pushbutton
(type="button") and not a Submit button (type="submit").

Then, add an onclick= atribute as shown below:

<input type="button" onclick="valForm();" value="Next"
name="btnNext">

Finally, add a script such as the following anywhere in
the Web page. (The <head> section is a common choice.)

<script>
function valForm(){
}
How do you, programmatically with JavaScript's, open the
next page ordisplay a blank page.

Inside the fucntion you just created, code whatever tests
you want want, then set window.location.href to the URL of
the next page to display. Here's an example that assumes a
text box named txtName shouldn't be empty.

<script>
function valForm(){
if (document.forms[0].txtName.value == "") {
return 0;
}
document.location.href="nextpage.htm";
}
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
S

Steve Easton

If your hosting server is using some flavor
of UNIX, you might want to try the .htaccess file
and .htpasswd file route.
It's really not that hard to do.
They are created in Notepad.
To save a Notepad file without a file
extension, select Save as and then type
in ".htpasswd" and click save.
Here's a "How to"

http://www.euronet.nl/~arnow/htpasswd/documentation.html

--
Steve Easton
MS MVP FrontPage
95isalive
This site is best viewed..................
...............................with a computer
 
J

JCO

Thanks Jim,
I have done this now. Is there a way to force an "Enter" on the text box to
automatically be the same as hitting the btnNext button? I've done this in
C++ code but not familiar with the JavaScript methods.

Jim Buyens said:
-----Original Message-----
I want to add a simple Form Field & Push Button so that
when selected, will validate a field to allow the user to
go to the next page or not. Nothing fancy.

I created a separate htm page with a form field:

How do you verify the field (when the button is selected)?

First, make sure the button is truly a pushbutton
(type="button") and not a Submit button (type="submit").

Then, add an onclick= atribute as shown below:

<input type="button" onclick="valForm();" value="Next"
name="btnNext">

Finally, add a script such as the following anywhere in
the Web page. (The <head> section is a common choice.)

<script>
function valForm(){
}
How do you, programmatically with JavaScript's, open the
next page ordisplay a blank page.

Inside the fucntion you just created, code whatever tests
you want want, then set window.location.href to the URL of
the next page to display. Here's an example that assumes a
text box named txtName shouldn't be empty.

<script>
function valForm(){
if (document.forms[0].txtName.value == "") {
return 0;
}
document.location.href="nextpage.htm";
}
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
J

Jim Buyens

Add this attribute to the text box:

onkeypress="if(event.keyCode==13) document.forms[0].btnNext.click();"

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------



JCO said:
Thanks Jim,
I have done this now. Is there a way to force an "Enter" on the text box to
automatically be the same as hitting the btnNext button? I've done this in
C++ code but not familiar with the JavaScript methods.

Jim Buyens said:
-----Original Message-----
I want to add a simple Form Field & Push Button so that
when selected, will validate a field to allow the user to
go to the next page or not. Nothing fancy.

I created a separate htm page with a form field:

How do you verify the field (when the button is selected)?

First, make sure the button is truly a pushbutton
(type="button") and not a Submit button (type="submit").

Then, add an onclick= atribute as shown below:

<input type="button" onclick="valForm();" value="Next"
name="btnNext">

Finally, add a script such as the following anywhere in
the Web page. (The <head> section is a common choice.)

<script>
function valForm(){
}
How do you, programmatically with JavaScript's, open the
next page ordisplay a blank page.

Inside the fucntion you just created, code whatever tests
you want want, then set window.location.href to the URL of
the next page to display. Here's an example that assumes a
text box named txtName shouldn't be empty.

<script>
function valForm(){
if (document.forms[0].txtName.value == "") {
return 0;
} document.location.href="nextpage.htm";
}
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Top