Reseting Form Fields

A

aghent

I've set up a drop down menu and text field for my customers to specify
certain criteria when ordering goods however when they click the "Add to
Basket" I want these two Form Fields to be reset to their initial values - in
the case of the text filed blank.

Anyone know how this can be done?

Any help appreciated.
 
K

Kevin Spencer

How it's done depends upon how the app is programmed to work already, that
is, what elements of it are server-side, what elements are client-side, what
clicking the "Add to Basket" button does, in other words, how the app is
structured. As you have not told us, we cannot answer until you do.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
 
M

MD Websunlimited

Hi,

The description of what you're wishing to accomplish is very lacking. What I believe you wish to do is reset specific fields to a
default value if they are blank when the visitor clicks the submit, "Add To Basket", button.

I recommend that you use an onclick event handler for the submit button.

<input type="submit" value="Add to Basket" onclick="checkFields(this);" >

The above calls a JavaScript function in the head that checks those fields you wish to ensure are not blank.

<script >
function checkFields(theForm) {
ret = true;
if (theForm.field1.value == '' ) {
theForm.field1.value = 'defaultvalue';
return ret;
}
}
</script>
 
A

aghent

Mike.
Thanks for the reply although I'm having trouble getting it to work. Perhaps
if I show the complete code for the form it might help:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post" onsubmit="return FrontPage_Form1_Validator(this)"
language="JavaScript">
<input type="hidden" name="on0" value="Name(s) Required">
<table><tr><td align="right"><font face="Verdana">
</font>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana"
size="2">Name(s) Required</font></td><td>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana">
<!--webbot bot="Validation" s-display-name="name" s-data-type="String"
b-value-required="TRUE" i-minimum-length="1" i-maximum-length="200" --><input
type="text" name="os0" maxlength="200" size="30"></font></td></tr></table>
<p style="margin-top: 0; margin-bottom: 0" align="center">
<font face="Verdana"><font size="2">
<input type="image" src="../images/Buttons/x-click-but22.gif" border="0"
name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</font>
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="0.5l Beer Stein">
<input type="hidden" name="item_number" value="BS001">
<input type="hidden" name="amount" value="12.30">
<input type="hidden" name="page_style" value="Primary">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="return"
value="http://www.agh-enterprises.com/thank_you.htm">
<input type="hidden" name="cancel_return"
value="http://www.agh-enterprises.com/index.htm">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</font>
</p>
</form>

Can't help thinking the webbot and validation bits might be throwing things
out. The bit I need to reset is the text box os2.

Appreciate your time thus far.

Andy
 
S

Stefan B Rusynko

1) there is no text box field named os2
- there is only a text box named os0
- for the field named :name
- w/ FP validation checking that it is not empty

2) there is also no drop down in that form code snippet
- only a single text field,
- a submit button, and
- the required PayPal hidden fields

Explain why you are attempting to do w/ what field

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Mike.
| Thanks for the reply although I'm having trouble getting it to work. Perhaps
| if I show the complete code for the form it might help:
|
| <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
| method="post" onsubmit="return FrontPage_Form1_Validator(this)"
| language="JavaScript">
| <input type="hidden" name="on0" value="Name(s) Required">
| <table><tr><td align="right"><font face="Verdana">
| </font>
| <p style="margin-top: 0; margin-bottom: 0"><font face="Verdana"
| size="2">Name(s) Required</font></td><td>
| <p style="margin-top: 0; margin-bottom: 0">
| <font face="Verdana">
| <!--webbot bot="Validation" s-display-name="name" s-data-type="String"
| b-value-required="TRUE" i-minimum-length="1" i-maximum-length="200" --><input
| type="text" name="os0" maxlength="200" size="30"></font></td></tr></table>
| <p style="margin-top: 0; margin-bottom: 0" align="center">
| <font face="Verdana"><font size="2">
| <input type="image" src="../images/Buttons/x-click-but22.gif" border="0"
| name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
| </font>
| <input type="hidden" name="add" value="1">
| <input type="hidden" name="cmd" value="_cart">
| <input type="hidden" name="business" value="(e-mail address removed)">
| <input type="hidden" name="item_name" value="0.5l Beer Stein">
| <input type="hidden" name="item_number" value="BS001">
| <input type="hidden" name="amount" value="12.30">
| <input type="hidden" name="page_style" value="Primary">
| <input type="hidden" name="no_shipping" value="2">
| <input type="hidden" name="return"
| value="http://www.agh-enterprises.com/thank_you.htm">
| <input type="hidden" name="cancel_return"
| value="http://www.agh-enterprises.com/index.htm">
| <input type="hidden" name="currency_code" value="GBP">
| <input type="hidden" name="bn" value="PP-ShopCartBF">
| </font>
| </p>
| </form>
|
| Can't help thinking the webbot and validation bits might be throwing things
| out. The bit I need to reset is the text box os2.
|
| Appreciate your time thus far.
|
| Andy
|
|
| "MD Websunlimited" wrote:
|
| > Hi,
| >
| > The description of what you're wishing to accomplish is very lacking. What I believe you wish to do is reset specific fields to
a
| > default value if they are blank when the visitor clicks the submit, "Add To Basket", button.
| >
| > I recommend that you use an onclick event handler for the submit button.
| >
| > <input type="submit" value="Add to Basket" onclick="checkFields(this);" >
| >
| > The above calls a JavaScript function in the head that checks those fields you wish to ensure are not blank.
| >
| > <script >
| > function checkFields(theForm) {
| > ret = true;
| > if (theForm.field1.value == '' ) {
| > theForm.field1.value = 'defaultvalue';
| > return ret;
| > }
| > }
| > </script>
| >
| > --
| > Mike -- FrontPage MVP '97 - '02
| > http://www.websunlimited.com
| > FrontPage Add-in
| >
| >
| > > I've set up a drop down menu and text field for my customers to specify
| > > certain criteria when ordering goods however when they click the "Add to
| > > Basket" I want these two Form Fields to be reset to their initial values - in
| > > the case of the text filed blank.
| > >
| > > Anyone know how this can be done?
| > >
| > > Any help appreciated.
| >
| >
| >
 
A

aghent

Okay, so a minor bit of finger trouble - os0 instead of os2.

This bit of coding doesn't have the drop down box but I figure the principle
would be the same.

As to what I'm trying to achieve, well that's in the original post I
thought. Clear the text box of any text once the Add To Basket button is
clicked.

Stefan B Rusynko said:
1) there is no text box field named os2
- there is only a text box named os0
- for the field named :name
- w/ FP validation checking that it is not empty

2) there is also no drop down in that form code snippet
- only a single text field,
- a submit button, and
- the required PayPal hidden fields

Explain why you are attempting to do w/ what field

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Mike.
| Thanks for the reply although I'm having trouble getting it to work. Perhaps
| if I show the complete code for the form it might help:
|
| <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
| method="post" onsubmit="return FrontPage_Form1_Validator(this)"
| language="JavaScript">
| <input type="hidden" name="on0" value="Name(s) Required">
| <table><tr><td align="right"><font face="Verdana">
| </font>
| <p style="margin-top: 0; margin-bottom: 0"><font face="Verdana"
| size="2">Name(s) Required</font></td><td>
| <p style="margin-top: 0; margin-bottom: 0">
| <font face="Verdana">
| <!--webbot bot="Validation" s-display-name="name" s-data-type="String"
| b-value-required="TRUE" i-minimum-length="1" i-maximum-length="200" --><input
| type="text" name="os0" maxlength="200" size="30"></font></td></tr></table>
| <p style="margin-top: 0; margin-bottom: 0" align="center">
| <font face="Verdana"><font size="2">
| <input type="image" src="../images/Buttons/x-click-but22.gif" border="0"
| name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
| </font>
| <input type="hidden" name="add" value="1">
| <input type="hidden" name="cmd" value="_cart">
| <input type="hidden" name="business" value="(e-mail address removed)">
| <input type="hidden" name="item_name" value="0.5l Beer Stein">
| <input type="hidden" name="item_number" value="BS001">
| <input type="hidden" name="amount" value="12.30">
| <input type="hidden" name="page_style" value="Primary">
| <input type="hidden" name="no_shipping" value="2">
| <input type="hidden" name="return"
| value="http://www.agh-enterprises.com/thank_you.htm">
| <input type="hidden" name="cancel_return"
| value="http://www.agh-enterprises.com/index.htm">
| <input type="hidden" name="currency_code" value="GBP">
| <input type="hidden" name="bn" value="PP-ShopCartBF">
| </font>
| </p>
| </form>
|
| Can't help thinking the webbot and validation bits might be throwing things
| out. The bit I need to reset is the text box os2.
|
| Appreciate your time thus far.
|
| Andy
|
|
| "MD Websunlimited" wrote:
|
| > Hi,
| >
| > The description of what you're wishing to accomplish is very lacking. What I believe you wish to do is reset specific fields to
a
| > default value if they are blank when the visitor clicks the submit, "Add To Basket", button.
| >
| > I recommend that you use an onclick event handler for the submit button.
| >
| > <input type="submit" value="Add to Basket" onclick="checkFields(this);" >
| >
| > The above calls a JavaScript function in the head that checks those fields you wish to ensure are not blank.
| >
| > <script >
| > function checkFields(theForm) {
| > ret = true;
| > if (theForm.field1.value == '' ) {
| > theForm.field1.value = 'defaultvalue';
| > return ret;
| > }
| > }
| > </script>
| >
| > --
| > Mike -- FrontPage MVP '97 - '02
| > http://www.websunlimited.com
| > FrontPage Add-in
| >
| >
| > > I've set up a drop down menu and text field for my customers to specify
| > > certain criteria when ordering goods however when they click the "Add to
| > > Basket" I want these two Form Fields to be reset to their initial values - in
| > > the case of the text filed blank.
| > >
| > > Anyone know how this can be done?
| > >
| > > Any help appreciated.
| >
| >
| >
 
S

Stefan B Rusynko

See http://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_options_help_outside
- and download/ look at the PayPal Integration guide

Once the button is clicked they should end up at the return page
http://www.agh-enterprises.com/thank_you.htm
and not be on the submit page any more
- next time they return to submit page it should be empty

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Okay, so a minor bit of finger trouble - os0 instead of os2.
|
| This bit of coding doesn't have the drop down box but I figure the principle
| would be the same.
|
| As to what I'm trying to achieve, well that's in the original post I
| thought. Clear the text box of any text once the Add To Basket button is
| clicked.
|
| "Stefan B Rusynko" wrote:
|
| > 1) there is no text box field named os2
| > - there is only a text box named os0
| > - for the field named :name
| > - w/ FP validation checking that it is not empty
| >
| > 2) there is also no drop down in that form code snippet
| > - only a single text field,
| > - a submit button, and
| > - the required PayPal hidden fields
| >
| > Explain why you are attempting to do w/ what field
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| > _____________________________________________
| >
| >
| > | Mike.
| > | Thanks for the reply although I'm having trouble getting it to work. Perhaps
| > | if I show the complete code for the form it might help:
| > |
| > | <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
| > | method="post" onsubmit="return FrontPage_Form1_Validator(this)"
| > | language="JavaScript">
| > | <input type="hidden" name="on0" value="Name(s) Required">
| > | <table><tr><td align="right"><font face="Verdana">
| > | </font>
| > | <p style="margin-top: 0; margin-bottom: 0"><font face="Verdana"
| > | size="2">Name(s) Required</font></td><td>
| > | <p style="margin-top: 0; margin-bottom: 0">
| > | <font face="Verdana">
| > | <!--webbot bot="Validation" s-display-name="name" s-data-type="String"
| > | b-value-required="TRUE" i-minimum-length="1" i-maximum-length="200" --><input
| > | type="text" name="os0" maxlength="200" size="30"></font></td></tr></table>
| > | <p style="margin-top: 0; margin-bottom: 0" align="center">
| > | <font face="Verdana"><font size="2">
| > | <input type="image" src="../images/Buttons/x-click-but22.gif" border="0"
| > | name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
| > | </font>
| > | <input type="hidden" name="add" value="1">
| > | <input type="hidden" name="cmd" value="_cart">
| > | <input type="hidden" name="business" value="(e-mail address removed)">
| > | <input type="hidden" name="item_name" value="0.5l Beer Stein">
| > | <input type="hidden" name="item_number" value="BS001">
| > | <input type="hidden" name="amount" value="12.30">
| > | <input type="hidden" name="page_style" value="Primary">
| > | <input type="hidden" name="no_shipping" value="2">
| > | <input type="hidden" name="return"
| > | value="http://www.agh-enterprises.com/thank_you.htm">
| > | <input type="hidden" name="cancel_return"
| > | value="http://www.agh-enterprises.com/index.htm">
| > | <input type="hidden" name="currency_code" value="GBP">
| > | <input type="hidden" name="bn" value="PP-ShopCartBF">
| > | </font>
| > | </p>
| > | </form>
| > |
| > | Can't help thinking the webbot and validation bits might be throwing things
| > | out. The bit I need to reset is the text box os2.
| > |
| > | Appreciate your time thus far.
| > |
| > | Andy
| > |
| > |
| > | "MD Websunlimited" wrote:
| > |
| > | > Hi,
| > | >
| > | > The description of what you're wishing to accomplish is very lacking. What I believe you wish to do is reset specific fields
to
| > a
| > | > default value if they are blank when the visitor clicks the submit, "Add To Basket", button.
| > | >
| > | > I recommend that you use an onclick event handler for the submit button.
| > | >
| > | > <input type="submit" value="Add to Basket" onclick="checkFields(this);" >
| > | >
| > | > The above calls a JavaScript function in the head that checks those fields you wish to ensure are not blank.
| > | >
| > | > <script >
| > | > function checkFields(theForm) {
| > | > ret = true;
| > | > if (theForm.field1.value == '' ) {
| > | > theForm.field1.value = 'defaultvalue';
| > | > return ret;
| > | > }
| > | > }
| > | > </script>
| > | >
| > | > --
| > | > Mike -- FrontPage MVP '97 - '02
| > | > http://www.websunlimited.com
| > | > FrontPage Add-in
| > | >
| > | >
| > | > > I've set up a drop down menu and text field for my customers to specify
| > | > > certain criteria when ordering goods however when they click the "Add to
| > | > > Basket" I want these two Form Fields to be reset to their initial values - in
| > | > > the case of the text filed blank.
| > | > >
| > | > > Anyone know how this can be done?
| > | > >
| > | > > Any help appreciated.
| > | >
| > | >
| > | >
| >
| >
| >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top