Click to See Complete Forum and Search --> : Disable submit button permanantly?


pamela_sews
11-17-2003, 03:19 PM
I was wondering if there was a code/script that would allow a "add to cart" button to become permanantly disabled after someone clicks it......and possibly enabled if they remove the item from the cart......but I also need it to stay that way when the next user visits the store.

**It would be an added plus if the "add to cart" button could change text to read SOLD when disabled.**

Reason I am asking is because there isn't inventory control, and I only make one of each item, I don't want multiple users to buy the same item before I can delete it from the page once sold.

I am DESPERATE for any help.

Here is my site if you need to "see" what I am looking for:

http://www.sew-savvy.com

Thanks in advance!!

fredmv
11-17-2003, 03:20 PM
<input type="submit" value="Add to Cart" onclick="this.disabled=true;return true;" />

pamela_sews
11-17-2003, 03:27 PM
It disables it for the moment but when I return to the page, it is active again. If I put the "onclick" next to the button, as you had it, it disables button but does not submit item.

here is the script I am using....maybe you can make sense of it.

I need the button so that it never becomes enabled again...ever! LOL

<td align="center"><!--Shopping Cart Begin-->
<P><FORM NAME=order ACTION="managecart.html" onSubmit="AddToCart(this);" onclick="this.disabled=true; return true;" />
<input type="submit" value="Add to Cart" >

<input type=hidden name=PRICE value="16.00">
<input type=hidden name=NAME value="Paisley Tote">
<input type=hidden name=ID_NUM value="T_Paisley">
</FORM>
<!--Shopping Cart End --></td>

Jona
11-17-2003, 07:26 PM
To permanently disable a button, it will have to be set up in the database to put "disabled" in the HTML code if the button has been clicked, which means your request can only be accomplished by a server-side script.

[J]ona