Skip to main content

Limit textarea characters, maybe display remaining

More
14 years 1 month ago #60522 by LenaK
I just noticed that I can put an unlimited amount of characters in my custom text areas. (oh oh)

I found where i need to put in a div for some javascript >>>> show_block_custom_item.php

Although this may be obvious to most programers, but where do I put my js file? And will a .html message display on the add to cart page?

I also found this plug online and wonder if it might be a better solution for what I'm looking to do. I don't see how because my plug specifically links with the textarea id.

Thanks in advance.
Lena

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #60550 by Jerome
Hi,

You can put your js file in the Joomla media directory.
It is possible to put it in the hikashop javascript directory, "new" files are not affected during updates.
You have to use the "JDocument::addScript" function to add your javascript file ( docs.joomla.org/JDocument/addScript )

I don't understand your question about the "html message on the add to cart page".

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: LenaK

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #60563 by LenaK
Not as easy as I thought it would be. Spinning my wheels again.

Not only did I want to limit the number of characters in a custom textarea (one of my textarea id's is "message"), I also wanted to show the users how many characters were remaining in the same window with the following js. This is what I meant by the html message on the add to cart page. I'm either not using proper syntax to add the necessary divs and/or there's another js language out there for joomla that doesn't jive with the js lessons i've been studying. The only way I can seriously be helped is (i think) to get explicit and detailed code of what to add where. :unsure:


This "message.js" file was uploaded to mywebsite/media/hikashop/js and I edited the show_block_custom_item.php file to include several divs as well as $doc =& JFactory::getDocument();
$doc->addScript(" www.mywebsite.com/media//hikashop/message.js ") and I'm getting nowhere fast.

message.js below

var message_max = 310;

$('#hikashop_item_message_line').keyup(function() {
var message_length = $('#hikashop_item_message_line').val().length;
var char_left = message_max - message_length;
${'#message_feedback'}.html('You have ' + char_left + ' remaining');
});

I can't believe no one else needs these stuff ...

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #60618 by nicolas
We'll add that to the next release of HikaShop which we'll do this week. It's easy to add and has already been requested once.
The following user(s) said Thank You: LenaK

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #60620 by LenaK
I sooooooooooo appreciate this program, and you!
Thank you. :woohoo:

Please Log in or Create an account to join the conversation.

Time to create page: 0.176 seconds
Powered by Kunena Forum