- Create Account

text edit not working on drag

Forums > DragResize > text edit not working on drag
Author
Message

1) sajan Group: Guests
IP: 122.171.--.--
Hi
    Drag resize is a wonderful script.I love this.I have a problem with drag.When i apply drag to input type text.i can't type text to the field.This problem is in firefox.In ie its working perfectly fine.Can u pls help me?

2) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 203.109.--.--
Elements that you make draggable must be able to have child DIVs inserted within them. I would suggest placing the <input> element within a DIV or similar, and making that draggable, that should work a lot better!

Good luck - Angus.

3) sajan Group: Guests
IP: 122.171.--.--
Hi angus actually this is my code .
<div class="drsElement1" style="left: 210px; top: 100px;width: 250px; height: 20px;"><input type="text" id="txtbox" value="Write Here" size="79" maxlength="50" style="border:none" readonly onClick="selectArea()" onblur="deselectArea()" /></div>
But  again i like to say its working in explorer not in firefox.Is it a firefox bug?
thanks

4) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
It should work OK in Firefox. Do you have a link to your whole implementation?

- Angus.

5) sajan Group: Guests
IP: 122.167.--.--
Hi
 currently there is no external link .so i am giving the code
///////////////////////////////
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../chat/themes/default/inner_page.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Draw figures</title>
<script type="text/javascript" src="scripts/prototype.js"></script>
<script type="text/javascript" src="scripts/dragresize.js"></script>
</SCRIPT>
<style type="text/css">
.drsElement {
 position:  absolute;
opacity:0.4;
cursor: move;
}
.drsElement1 {
position: absolute;
opacity:0.9;
}
.drsMoveHandle  {
 height: 100%;
opacity:0.9;
  cursor:  move;
}
.drsMoveHandle1 {
opacity:1;
  cursor: move;
}
.dragresize {
position: absolute;
 width: 5px;
 height: 5px;
 font-size: 1px;
 background: #EEE;
 border:  1px solid #333;
}
.dragresize-tl  {
 top: -8px;
 left:  -8px;
 cursor: nw-resize;
}
.dragresize-tm {
top: -8px;
 left: 50%;
 margin-left: -4px;
 cursor:  n-resize;
}
.dragresize-tr {
top: -8px;
 right: -8px;
cursor: ne-resize;
}
.dragresize-ml {
top: 50%;
 margin-top: -4px;
 left:  -8px;
 cursor: w-resize;
}
.dragresize-mr {
top: 50%;
 margin-top: -4px;
 right:  -8px;
 cursor: e-resize;
}
.dragresize-bl {
bottom: -8px;
 left: -8px;
cursor: sw-resize;
}
.dragresize-bm {
bottom: -8px;
 left: 50%;
 margin-left: -4px;
 cursor:  s-resize;
}
.dragresize-br {
bottom: -8px;
 right: -8px;
cursor: se-resize;
}
</style>

6) sajan Group: Guests
IP: 122.167.--.--
<script type="text/javascript">
//<![CDATA[
var dragresize = new DragResize('dragresize',
 { minWidth: 50, minHeight: 100, minLeft: 10,maxLeft:1000, maxTop: 600 });

dragresize.isElement  = function(elm)
{
 if (elm.className  && elm.className.indexOf('drsElement') > -1) return true;
 if (elm.className &&  elm.className.indexOf('drsElement1') > -1) return true;
};
dragresize.isHandle = function(elm)
{
 if (elm.className &&  elm.className.indexOf('drsElement') > -1) return true;
  if (elm.className &&  elm.className.indexOf('drsMoveHandle1') > -1) return true;

};
dragresize.ondragfocus  = function() { };
dragresize.ondragstart = function(isResize)  { };
dragresize.ondragmove = function(isResize) { };
dragresize.ondragend = function(isResize) { };
dragresize.ondragblur  = function() { };
dragresize.apply(document);

//]]>
  
</script>
<link  rel="stylesheet" type="text/css" href="css/ima.css" />
</head>
<body  oncontextmenu="return false;">
<table width="100%"><tr><td align="center">
</td></tr></table>
 <div  class="drsElement1" style="left: 210px; top: 100px;width: 250px; height: 20px;"><input type="text" id="txtbox" value="Write Here" size="79" maxlength="50" style="border:none" readonly onClick="selectArea()" onblur="deselectArea()" /></div>
<script language="javascript">
function selectArea(txtbox){
 $(txtbox).readOnly=false;
 $(txtbox).style.border='1px  solid #AEFFAE';
}
function deselectArea(txtbox){
alert('dselect');
 $(txtbox).readOnly=true;
 $(txtbox).style.border='none';
}
</script>
</body>
</html>
/////////////////////////////
Also the resize handle at the bottom middle is not working.
thanks


7) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
1) Use onfocus/onblur or just CSS pseudoclasses perhaps?
2) You need to actually pass a txtbox param, try selectbox(this) or similar.

I just added an <input> to the demo and it worked just fine, so it's not a script problem!

- Angus.

8) sajan Group: Guests
IP: 122.167.--.--
Can u explain pls?.(Can u move and edit in firefox now?).Can u pls show me the working code?.
thanks

9) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
I took the example script, straight out of the zipfile, and put <input type="text" /> in place of the text within a DIV. That's all. Worked fine, FF v2.0.0.11.

- Angus.

10) sajan Group: Guests
IP: 121.247.--.--
Well there may be some mistakes on my part.Anyway this script is a wonderful thing.I request you to upgrade it to more powerful.
thanks

11) sajan Group: Guests
IP: 122.167.--.--
Ya here is the problem
 Pls check this
<div class="drsElement"
 style="left: 210px; top: 100px; width: 150px; height: 120px;
 background: #FDC; text-align: center">
 <div class="drsMoveHandle"><input type="text" id="txtbox" value="Write Here" size="79" maxlength="50" style="border:none" /></div>
</div>
if u put text in the drsMoveHandle u can't edit text(in ff).if u put inside div with class drsElement but outside drsMoveHandle u can edit.
But i want move and edit.Do u have any idea?

12) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 203.173.--.--
Oh, I wasn't putting text inside the move handle! That could well cause problems as the script does cancel mousedown/focus events to avoid selecting document text as you drag.

Probably just put the <INPUT> element after drsMoveHandle? You can always use STYLE="margin-top: -20px" to move it back up...

- Angus.

13) sajan Group: Guests
IP: 122.167.--.--
But somehow its working in IE.Thanks for your prompt reply.
Best of luck.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.