Add default value to TextArea
Hi,
Just a question is it possible to add feature in product_details.tpl. When user add new product, select category A, show Text-A in description field. or when select category B, show Text-B in description field. All this happen in admin area. Anyway to do this? Please advice. thx |
Re: Add default value to TextArea
Perhaps JavaScript will be the best answer. You can put an onChange or onClick event on the category select box, and then set the value of the textarea based on that.
http://www.w3schools.com/jsref/event_onchange.asp http://stackoverflow.com/questions/415602/set-value-of-textarea-in-jquery |
Re: Add default value to TextArea
thx, I ll try it later on. :-)
|
Re: Add default value to TextArea
Hi,
I hav success create a html version. <p>Select a new car from the list.</p> <select id="mySelect" onChange="myFunction()"> <option value="Audi">Audi <option value="BMW">BMW <option value="Mercedes">Mercedes <option value="Volvo">Volvo </select> <p>When you select a new car, a function is triggered which outputs the value of the selected car.</p> <form name="form1" method="post" action=""> <label>aaa <textarea name="textarea" id="textArea"></textarea> </label> </form> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("mySelect").value; document.getElementById("demo").innerHTML = "You selected: " + x; document.getElementById("textArea").value ="text " + x; //$("textarea#ExampleMessage").val(result.exampleMes sage); } </script> but how to integrate into smarty tmpl? the code are difference. {include file="main/textarea.tpl" name="descr" cols=45 rows=8 data=$product.descr width="100%" btn_rows=4} |
Re: Add default value to TextArea
The product short decription text area in my version has an ID of "descr".
Assuming your code above is good, I think you would need: $("#descr").val(result.exampleMes sage); When adding javascript to smarty tmeplates, you need to wrap it with {literal} {/literal} tags on either side. It might be best for you to hire a developer to do this for you, if you do not understand how to go further with these examples. It will save you time, and time is money. :-) |
Re: Add default value to TextArea
Thx Guru, I had done this and it work.
|
All times are GMT -8. The time now is 04:38 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.