| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Add default value to TextArea | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
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
__________________
X-Cart : 4.5.2 Sunday Morning... |
|||||||
#2
|
|||||||||
|
|||||||||
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
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#3
|
|||||||
|
|||||||
Re: Add default value to TextArea
thx, I ll try it later on.
__________________
X-Cart : 4.5.2 Sunday Morning... |
|||||||
#4
|
|||||||
|
|||||||
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}
__________________
X-Cart : 4.5.2 Sunday Morning... |
|||||||
#5
|
|||||||||
|
|||||||||
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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|