Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Maximum number of characters in comment box?

Maximum number of characters in comment box?

Locked

Started by jurjenruben on 3 Apr 2008, 7:04 PM · Views: 3,184

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

Post #1 by jurjenruben

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,512
Plugin Contributions:
176

Post #2 by drbyte

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.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

jurjenruben

New Zenner

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

Post #3 by jurjenruben

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;
                        }