Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post Adding <script> 
 
I've added textbox with my emff player bbcode, like this.
 image3

The problem is with script which on click in codebox selects everything inside.
In the beginning it was working fine, and the suddenly stoped working.
I have added this in veiwtopic_body.tpl, after line "<script>"
Code: [Download] [Hide] [Select]
function select_text()
{
var content=eval("document.myform.field");
content.focus();
content.select();
}


And in bbcode
Code: [Download] [Hide] [Select]
<form method="post" action="" name="myform" >
<textarea name="field" rows="4" cols="40" onClick="select_text();">Click Inside the text area to select all
  text within this form field </textarea>
</form>


It appears to me like that script isn't loading, could anything be blockin it?
In fresh instalation works fine.

--------

I just found out that problem begins when two posts are posted, and both call that javascript.
So in viewtopic_body.tpl is not good place to put it.

So where is best place to put that javascript?
 



 
strujaSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Adding <script> 
 
struja wrote: [View Post]

So where is best place to put that javascript?


maybe in templatescommonjs
 




____________
We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
 
LimunSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding <script> 
 
Nope, it didn't work.
 



 
strujaSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding <script> 
 
The problem is that you need to assign an ID to the form and then pass it to the JS so you can have multiple form and you will be able to select multiple text in the same page.

Try to check how QuickQuote works...
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding <script> 
 
I've tried with this

Code: [Download] [Hide] [Select]
<script type=”text/javascript”>
function SelectAll(id)
{
document.getElementById(id).focus();
document.getElementById(id).select();
}
</script>

<textarea rows="3" id="HERE" onClick="SelectAll('HERE');" style="width:200px" >This text you can select all by clicking here </textarea>



But problem, at least for me is. How to assign unique value there.
I tried just putting ' . $post_id . ' , nothing happened.
 



 
strujaSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding <script> 
 
If you don't have an ID, then you need to create a random ID using some random function and then send it to template.

Check also bbcode.php what has been done for code select and download.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding <script> 
 
So I added this code before $html to generate that random id.
Code: [Download] [Hide] [Select]
$box_id = substr(md5($content . mt_rand()), 0, 8);

it is working for now.

Thanks MG, for your guidance. It was much better for me than just a solution.  
 



 
strujaSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding <script> 
 
Great!
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron