damnated Posted May 20, 2011 Share Posted May 20, 2011 Hi, I want to replicate an input that uses multiple languages, and tinymce. Like the ones used in the product description page in the admin for instance. Basically I want to click on a flag, enter the text, click on another flag, enter text etc.I simplified the appearance of the flags somewhat, it's just a line now, but I have an issue with tinymce. The first div, which is visible by default loads up just fine. However, if I click on another flag, to reveal another textarea, this shows up all weird, it looks like the attachment. My code looks like this:The images call a function onclick event with the following parameters changeRulesLanguage(this, 'rules', , 'div' ) . The function looks like this function changeRulesLanguage(obj, e_id, id, e){ l = obj[removed].getElementsByTagName(e); for (i=0; i l[i].style.display = "none"; } document.getElementById(e_id+"_"+id).style.display = "block"; } The HTML looks like this Rules: en <textarea class="rte" cols="100" rows="20" name="rules_1"></textarea> fr<textarea class="rte" cols="100" rows="20" name="rules_2"></textarea> es<textarea class="rte" cols="100" rows="20" name="rules_3"></textarea> de<textarea class="rte" cols="100" rows="20" name="rules_4"></textarea> it<textarea class="rte" cols="100" rows="20" name="rules_5"></textarea> Choose language: Now, the hiding works just fine, but I'm guessing the revealing part (setting the display of the next div to 'block') is faulty. But I have no idea how to do it, 'cause I used this script on other (non prestashop) sites that used tinymce with success. Please advise! Link to comment Share on other sites More sharing options...
damnated Posted May 21, 2011 Author Share Posted May 21, 2011 The images trigger the function, on the 'onclick' event. I wrote it above, clearly. If you don't bother to read what I wrote, but still have the urge to post witty, unconstructive comments, please do so in another place.FYI, I wrote in it in the HTML above as well, but for some reason this forum escaped them from my post. I edited it later, but they wont show up... I've never seen anything like this. Link to comment Share on other sites More sharing options...
damnated Posted May 22, 2011 Author Share Posted May 22, 2011 I tried “translatable” with displayFlags() at first, but it had a glitch as well, it didn't change the divs properly, only the selected flags. This would be displayed only in a modules config page in the BO. Also, I'm using firefox and I was constantly monitoring the error console. There were no js errors at all, however. Link to comment Share on other sites More sharing options...
damnated Posted May 22, 2011 Author Share Posted May 22, 2011 I figured it out, I don't know why I took so long, but it just popped into my head. That script didn't change the visibility of nested divs. function changeRulesLanguage(obj, e_id, id, e) { l = obj[removed].getElementsByTagName(e); for (i=0; i l[i].style.display = "none"; } selected = document.getElementById(e_id+"_"+id); document.getElementById(e_id+"_"+id).style.display = "block"; l = selected.getElementsByTagName('div'); for (i=0; i l[i].style.display = "block"; } } This does. Thanks for the effort, I appreciate it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now