Zen Cart Logo
Forums / General Questions / Maximum number of characters in comment box?

Maximum number of characters in comment box?

Locked

Views: 3,178

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
3 Apr 2008, 7:04 PM
#1
jurjenruben avatar

jurjenruben

New Zenner

Join Date:
Dec 2007
Posts:
86
Plugin Contributions:
0

Maximum number of characters in comment box?

HI all,

I'dd like to have the following, hope someone can help me out with this:

During step 1 of the checkout, customers have the possibility to add comments/instructions in the text box. I'd like to have a restriction of, let's say, 200 characters. Preferably, I'd have a "counter" above text box, which counts down from 200 to 0, as the customer types.

Is that possible?

Thanks,
Jurjen

4 Apr 2008, 7:00 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Maximum number of characters in comment box?

You could hack out a copy of the html in the code which already does that, from the attributes module and implement it on your checkout page.

Partially discussed here, in reverse: http://www.zen-cart.com/forum/showthread.php?t=50075
And you'll need to copy the appropriate jscript_xxxxx.xxx file from the product page to the appropriate checkout page.

4 Apr 2008, 2:09 PM
#3
jurjenruben avatar

jurjenruben

New Zenner

Join Date:
Dec 2007
Posts:
86
Plugin Contributions:
0

Re: Maximum number of characters in comment box?

Ok, thanks. What file should I be adding the code to? Not the Templates I guess?
And this is the proper code?

 if ((ereg_replace('txt_', '', $key) == $products_options_names->fields['products_options_id'])) {
                          // use text area or input box based on setting of products_options_rows in the products_options table
                          if ( $products_options_names->fields['products_options_rows'] > 1) {
                            $tmp_html = '  <input disabled="disabled" type="text" name="remaining' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . '" size="3" maxlength="3" value="' . $products_options_names->fields['products_options_length'] . '" /> ' . TEXT_MAXIMUM_CHARACTERS_ALLOWED . '<br />';
                            $tmp_html .= '<textarea class="attribsTextarea" name="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" rows="' . $products_options_names->fields['products_options_rows'] . '" cols="' . $products_options_names->fields['products_options_size'] . '" onKeyDown="characterCount(this.form[\'' . 'id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']\'],this.form.' . TEXT_REMAINING . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ',' . $products_options_names->fields['products_options_length'] . ');" onKeyUp="characterCount(this.form[\'' . 'id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']\'],this.form.' . TEXT_REMAINING . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ',' . $products_options_names->fields['products_options_length'] . ');" id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '" >' . stripslashes($value) .'</textarea>' . "\n";
                          } else {
                            $tmp_html = '<input type="text" name="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" size="' . $products_options_names->fields['products_options_size'] .'" maxlength="' . $products_options_names->fields['products_options_length'] . '" value="' . stripslashes($value) .'" id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '" />  ';
                          }
                          $tmp_html .= $products_options_details;
                          break;
                        }