Zen Cart Logo

Required stop working

Locked

Views: 856

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
22 Apr 2010, 5:47 PM
#1
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Required stop working

attribute used to be txt_1 and now is labeled as TEXT_PREFIX1 in the source code of the product page.

Issue:
No form validation for the attribute field that is setup with REQUIRED.

I found this link to another person's forum post asking the same question back in Dec. 2007 with no reply: http://www.zen-cart.com/forum/showpost.php?p=472144&postcount=1

Any help would be great as my store no longer checks to make sure there is a needed value present.

Now looks like this: (no Required action)

<input type="text" name="id[TEXT_PREFIX1]" size="32" maxlength="32" value="" id="attrib-1-0" />  

Was this: (Required action)

<input type="text" name="id[txt_1]" size="32" maxlength="32" value="" id="attrib-1-0" />  

Please assist as I can't locate an answer. Thank you

22 Apr 2010, 8:48 PM
#2
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Required stop working

So my Required attribute died...

I put together some javascript to run when the "Add to Cart" button is pressed:

Thanks to w3school:

<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_form(thisform)
{
with (thisform)
  {
	if(validate_required(document.getElementById("attrib-1-0"),"Please click child's name from list.")==false)
  {options.focus();return false;}
  }
}
</script>

however, I can't seem to find the correct page in zen-cart to place the onSubmit for the image. Can anybody help locate this page? I tried the dev tool in admin but maybe I am searching incorrectly.

onSubmit or onClick

Summary... I want my validate_form(thisform) to run either by submitting the form or when Add to Cart button is pressed.

Thank you

23 Apr 2010, 3:19 PM
#4
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Required stop working

Ajeh:

Did you check this post to see if you are having similar problems?
http://www.zen-cart.com/forum/showthread.php?t=69217

Ajeh:

There was something really dumb the other day ... where a setting was missing from someone's database that was causing this ...

Think ... Think ... Think ... :frusty:

I remember!!! :clap:

Google Site map is one possibility where it wipes out some settings ...

The other is that any of these are missing from the configuration table ...

In the Tools ... Insert SQL Patch ... enter these:

INSERT INTO configuration VALUES ('', 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO configuration VALUES ('', 'Upload prefix', 'UPLOAD_PREFIX', 'upload_', 'Prefix used to differentiate between upload options and other options', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO configuration VALUES ('', 'Text prefix', 'TEXT_PREFIX', 'txt_', 'Prefix used to differentiate between text option values and other option values', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO configuration VALUES ('', 'Image Handler Version', 'IH_VERSION', '2.0', 'This is used by image handler to check if the database is up to date with uploaded image handler files.', 0, 100, NULL, '2007-06-06 16:47:03', NULL, 'zen_cfg_textarea_small(');

> 
> 
> edited for buzz word: fix attributes required requiring requires for text is broken or stopped working

That did the trick! Thanks... :clap: and here I was trying to insert my own form validation.... :cry:
23 Apr 2010, 3:38 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Required stop working

Surprisingly ... I was just now on a site that was experiencing this exact same issue ... :eek:

Guess what?! This worked for me too!! :flex:

23 Apr 2010, 4:17 PM
#6
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Required stop working

Ajeh:

Surprisingly ... I was just now on a site that was experiencing this exact same issue ... :eek:

Guess what?! This worked for me too!! :flex:

I didn't have any mods that caused this.. It was a database recovery(from backup) that messed with this "required text" issue. (just more info for possible others that might be experiencing this issue after a rollback.)

Now... I am looking for easy to follow steps for creating a test or dev environment for 1.3.9a ;-)

8 Nov 2010, 1:57 PM
#7
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Required stop working

I had to repeat this procedure after installing the contribution named: Recover Site Sales.

Not sure why.. but a simple SQL copy and paste and my "required" started working again.