472,789 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

Dragable Textbox Focus Problem

4
Hi,
I am using 8 dragable textboxes. here the problem is focus of a dragable textbox, it is working fine in IE6 but it is not working in firefox. If i apply focus() then focus is working but i am loosing dragable feature. But i need both can any one help me plz to solve this problem.
Jul 20 '07 #1
6 1589
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

please post some code concerning your problem ... show how you add the event-handlers ...

kind regards
Jul 20 '07 #2
hi ...

welcome to TSDN ...

please post some code concerning your problem ... show how you add the event-handlers ...

kind regards
Hi,
i am sending my code can u help me
<?php
include('db_config.php');
/*mysql_connect('localhost', 'root','');
mysql_select_db('wakapa_db');
error_reporting(E_ALL^E_WARNING^E_NOTICE);
*/
$_REQUEST['uid'] = 1;


function parse_data($data){
$containers = explode(":", $data);
foreach($containers AS $container)
{
$container = str_replace(")", "", $container);
$i = 0;
$lastly = explode("(", $container);
$values = explode(",", $lastly[1]);
foreach($values AS $value)
{
if($value == '')
{
continue;
}
$final[$lastly[0]][] = $value;
$i ++;
}
}
return $final;
}





function update_db($data_array, $col_check){
foreach($data_array AS $set => $items)
{
$i = 0;
foreach($items AS $item)
{
$item = mysql_escape_string($item);
$set = mysql_escape_string($set);
$value=$value.$item.",";
$i ++;
}
}

$storyarr=explode(",",$value);
for($i=0;$i<count($storyarr)-1;$i++){
$txtbox = "txtlist".$storyarr[$i];
$urltxtbox = "txturllist".$storyarr[$i];
$order_id = ($i+1);

$selectval="select * from todays_news where uid=".$_REQUEST['uid'];
$resultval=mysql_query($selectval);
$valueresult=mysql_num_rows($resultval);

if($valueresult>0){
$updatestory="update todays_news set label='".$_POST[$txtbox]."',url='".$_POST[$urltxtbox]."' where uid=".$_REQUEST['uid']." and order_id=".$order_id;
mysql_query($updatestory);
}
else{
for($i=1;$i<=8;$i++){
echo $insertq = "insert into todays_news(order_id,uid,label,url) values(".$i.",".$_REQUEST['uid'].",'".$_POST[$txtbox]."','".$_POST[$urltxtbox]."')";
mysql_query($insertq);
}
}
}
}








// Lets setup Sajax
require_once('dd/Sajax.php');
sajax_init();
// $sajax_debug_mode = 1;

function sajax_update($data){
$data = parse_data($data);
update_db($data, "AND (`set` = 'sajax1' OR `set` = 'sajax2')");
return 'y';
}

sajax_export("sajax_update");
sajax_handle_client_request();

if(isset($_POST['order']))
{
$data = parse_data($_POST['order']);
update_db($data, "AND (`set` = 'left_col' OR `set` = 'right_col' OR `set` = 'center')");
// redirect so refresh doesnt reset order to last save
}
?>









<html>
<head>
<title>Drag Drop</title>
<style type="text/css">
#left_col {
width: 180px;
float: left;
margin-left: 5px;
}

#center {
width: 180px;
float: left;
margin-left: 5px;
}

#right_col {
width: 180px;
float: left;
margin-left: 5px;
}

#sajax1 {
width: 180px;
float: left;
margin-left: 5px;
}

#sajax2 {
width: 180px;
float: left;
margin-left: 5px;
}

form {
clear: left;
}


h2 {
color: #7DA721;
font-weight: normal;
font-size: 14px;
margin: 20px 0 0 0;
}

br {
clear: left;
}

.form-text{
width: 8em;
height: 1.9em;
padding: 0 0.2em 0 0.2em;
margin: 0 0 0.5em 0;
border: 1px solid #744533;
}
input.button
{
color:#FFFFFF;
font-size:9.0pt;
font-weight:bold;
border:0.8pt
border-color:#FF3333;
color:#000000;
height:18.0pt;
width:66.0pt;
font-family:Verdana;
filter:progid:DXImageTransform.Microsoft.Gradient

(GradientType=0,StartColorStr='#cccccc',EndColorSt r='#FFFFFF');
}
</style>

<link rel="stylesheet" href="dd/dd_files/lists.css" type="text/css">
<script language="JavaScript" type="text/javascript" src="dd/dd_files/coordinates.js"></script>
<script language="JavaScript" type="text/javascript" src="dd/dd_files/drag.js"></script>
<script language="JavaScript" type="text/javascript" src="dd/dd_files/dragdrop.js"></script>
<script type="text/javascript" src="dd/dd_files/ajaxObj.js"></script>
<script language="JavaScript" type="text/javascript"><!--
<?php sajax_show_javascript(); ?>

function confirm(z){
window.status = 'Sajax version updated';
}

function onDrop() {

var data = DragDrop.serData('g2');
x_sajax_update(data, confirm);
}

window.onload = function() {
var list = document.getElementById("center");
DragDrop.makeListContainer( list, 'g1' );
list.onDragOver = function() { this.style['background'] = "#EEF"; };
list.onDragOut = function() {this.style['background'] = "none"; };

};

function getSort(){
alert("rama");
var order = document.getElementById("order");
alert(order);
order.value = DragDrop.serData('g1', null);
alert(order.value);
//showValue();
}

function showValue(){

order = document.getElementById("order");

}
function updatenull(id){

document.getElementById("txt"+id).value='';
//story=document.getElementById(
story='';
getSort();
document.draggg.action="dd.php?vid="+encodeURI(id) +"&storypost="+encodeURI(story);
document.draggg.submit();
}
function deleteBox(id){
document.getElementById(id).value = '';
getSort();
document.draggg.submit();
}

function load() {
document.forms[0].txtlist8.focus();
}

/*function init()
{
document.getElementById('txtlist1').focus()";
}*/

//-->
</script>
</head>
<body onload="load();">
<form action="" name="draggg" id="draggg" method="post">

<table width=95% cellpadding=0 cellspacing="0" border="0" align="center" style="cursor:pointer;"><tr><td>Today's News:</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td width="50%">Label:</td><td>URL</td></tr></table>
<table cellpadding=0 cellspacing="0" border="0" width="690px">
<tr>
<td width="690px">
<ul name="center" id="center" class="sortable boxy" style="width:690px">
<?
$j=1;
$r = mysql_query("select * from todays_news where uid=".$_REQUEST['uid']);
while($rw = mysql_fetch_array($r)){
if($rw['label']!=""){
echo '<li name="list'.$j.'" id="list'.$j.'" value="'.$j.'" style="width:690px"><div name="list'.$j.'" id="list'.$j.'" value="'.$j.'"><table border="0" cellpadding=0 cellspacing="0" width=100%><tr><td><input type="text" class="form-text" style="width:24em;" value="'.$rw['label'].'" name="txtlist'.$j.'" id="txtlist'.$j.'"></td><td width="10">&nbsp;</td><td><strong><a href="#"><span><input type="text" class="form-text" style="width:24em;" value="'.$rw['url'].'" id="txturllist'.$j.'" name="txturllist'.$j.'"></span></a></strong></td><td><a href="#" onclick="deleteBox(\'list'.$j.'\');">X</a></td></tr></table></div></li>';
$j++;
}
}
for($k=$j;$k<=8;$k++){
echo '<li name="list'.$k.'" id="list'.$k.'" value="'.$k.'" style="width:690px"><div name="list'.$k.'" id="list'.$k.'" value="'.$k.'"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><input type="text" name="txtlist'.$k.'" id="txtlist'.$k.'" value="" class="form-text" style="width:24em;"></td><td width="10">&nbsp;</td><td><strong><a href="#"><span><input type="text" name="txturllist'.$k.'" id="txturllist'.$k.'" value="" class="form-text" style="width:24em;"></span></a></strong></td><td><a href="#" onclick="deleteBox(\'list'.$k.'\');">X</a></td></tr></table></div></li>';
}
?>
</ul>
</td>
</tr>
</table>


<br/>
<input type="hidden" name="order" id="order" value="" />
<input type="hidden" name="uid" id="uid" value="<?echo $_REQUEST['uid'];?>" />
<input type="submit" class="form-submit" onclick="getSort()" value="Update Order" />
</form>
</body>
</html>
Jul 20 '07 #3
atram
4
hi ...

welcome to TSDN ...

please post some code concerning your problem ... show how you add the event-handlers ...

kind regards
Hi,
i am sending my code can u help me

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include('db_config.php');
  3. /*mysql_connect('localhost', 'root','');
  4. mysql_select_db('wakapa_db');
  5. error_reporting(E_ALL^E_WARNING^E_NOTICE);
  6. */
  7. $_REQUEST['uid'] = 1;
  8.  
  9.  
  10. function parse_data($data){
  11. $containers = explode(":", $data);
  12. foreach($containers AS $container)
  13. {
  14. $container = str_replace(")", "", $container);
  15. $i = 0;
  16. $lastly = explode("(", $container);
  17. $values = explode(",", $lastly[1]);
  18. foreach($values AS $value)
  19. {
  20. if($value == '')
  21. {
  22. continue;
  23. }
  24. $final[$lastly[0]][] = $value;
  25. $i ++;
  26. }
  27. }
  28. return $final;
  29. }
  30.  
  31. function update_db($data_array, $col_check){
  32. foreach($data_array AS $set => $items)
  33. {
  34. $i = 0;
  35. foreach($items AS $item)
  36. {
  37. $item = mysql_escape_string($item);
  38. $set = mysql_escape_string($set);
  39. $value=$value.$item.",";
  40. $i ++;
  41. }
  42. }
  43.  
  44. $storyarr=explode(",",$value);
  45. for($i=0;$i<count($storyarr)-1;$i++){
  46. $txtbox = "txtlist".$storyarr[$i];
  47. $urltxtbox = "txturllist".$storyarr[$i];
  48. $order_id = ($i+1);
  49.  
  50. $selectval="select * from todays_news where uid=".$_REQUEST['uid'];
  51. $resultval=mysql_query($selectval);
  52. $valueresult=mysql_num_rows($resultval);
  53.  
  54. if($valueresult>0){
  55. $updatestory="update todays_news set label='".$_POST[$txtbox]."',url='".$_POST[$urltxtbox]."' where uid=".$_REQUEST['uid']." and order_id=".$order_id;
  56. mysql_query($updatestory);
  57. }
  58. else{
  59. for($i=1;$i<=8;$i++){
  60. echo $insertq = "insert into todays_news(order_id,uid,label,url) values(".$i.",".$_REQUEST['uid'].",'".$_POST[$txtbox]."','".$_POST[$urltxtbox]."')";
  61. mysql_query($insertq);
  62. }
  63. }
  64. }
  65. }
  66. // Lets setup Sajax
  67. require_once('dd/Sajax.php');
  68. sajax_init();
  69. // $sajax_debug_mode = 1;
  70.  
  71. function sajax_update($data){
  72. $data = parse_data($data);
  73. update_db($data, "AND (`set` = 'sajax1' OR `set` = 'sajax2')");
  74. return 'y';
  75. }
  76.  
  77. sajax_export("sajax_update");
  78. sajax_handle_client_request();
  79.  
  80. if(isset($_POST['order']))
  81. {
  82. $data = parse_data($_POST['order']);
  83. update_db($data, "AND (`set` = 'left_col' OR `set` = 'right_col' OR `set` = 'center')");
  84. // redirect so refresh doesnt reset order to last save
  85. }
  86. ?>
  87. <html>
  88. <head>
  89. <title>Drag Drop</title>
  90. <style type="text/css">
  91. #left_col {
  92. width: 180px;
  93. float: left;
  94. margin-left: 5px;
  95. }
  96.  
  97. #center {
  98. width: 180px;
  99. float: left;
  100. margin-left: 5px;
  101. }
  102.  
  103. #right_col {
  104. width: 180px;
  105. float: left;
  106. margin-left: 5px;
  107. }
  108.  
  109. #sajax1 {
  110. width: 180px;
  111. float: left;
  112. margin-left: 5px;
  113. }
  114.  
  115. #sajax2 {
  116. width: 180px;
  117. float: left;
  118. margin-left: 5px;
  119. }
  120.  
  121. form {
  122. clear: left;
  123. }
  124.  
  125.  
  126. h2 {
  127. color: #7DA721;
  128. font-weight: normal;
  129. font-size: 14px;
  130. margin: 20px 0 0 0;
  131. }
  132.  
  133. br {
  134. clear: left;
  135. }
  136.  
  137. .form-text{
  138. width: 8em;
  139. height: 1.9em;
  140. padding: 0 0.2em 0 0.2em;
  141. margin: 0 0 0.5em 0;
  142. border: 1px solid #744533;
  143. }
  144. input.button
  145. {
  146. color:#FFFFFF;
  147. font-size:9.0pt;
  148. font-weight:bold;
  149. border:0.8pt
  150. border-color:#FF3333;
  151. color:#000000;
  152. height:18.0pt;
  153. width:66.0pt;
  154. font-family:Verdana;
  155. filter:progid:DXImageTransform.Microsoft.Gradient
  156.  
  157. (GradientType=0,StartColorStr='#cccccc',EndColorSt r='#FFFFFF');
  158. }
  159. </style>
  160.  
  161. <link rel="stylesheet" href="dd/dd_files/lists.css" type="text/css">
  162. <script language="JavaScript" type="text/javascript" src="dd/dd_files/coordinates.js"></script>
  163. <script language="JavaScript" type="text/javascript" src="dd/dd_files/drag.js"></script>
  164. <script language="JavaScript" type="text/javascript" src="dd/dd_files/dragdrop.js"></script>
  165. <script type="text/javascript" src="dd/dd_files/ajaxObj.js"></script>
  166. <script language="JavaScript" type="text/javascript"><!--
  167. <?php sajax_show_javascript(); ?>
  168.  
  169. function confirm(z){
  170. window.status = 'Sajax version updated';
  171. }
  172.  
  173. function onDrop() {
  174.  
  175. var data = DragDrop.serData('g2');
  176. x_sajax_update(data, confirm);
  177. }
  178.  
  179. window.onload = function() {
  180. var list = document.getElementById("center");
  181. DragDrop.makeListContainer( list, 'g1' );
  182. list.onDragOver = function() { this.style['background'] = "#EEF"; };
  183. list.onDragOut = function() {this.style['background'] = "none"; };
  184.  
  185. };
  186.  
  187. function getSort(){
  188. alert("rama");
  189. var order = document.getElementById("order");
  190. alert(order);
  191. order.value = DragDrop.serData('g1', null);
  192. alert(order.value);
  193. //showValue();
  194. }
  195.  
  196. function showValue(){
  197.  
  198. order = document.getElementById("order");
  199.  
  200. }
  201. function updatenull(id){
  202.  
  203. document.getElementById("txt"+id).value='';
  204. //story=document.getElementById(
  205. story='';
  206. getSort();
  207. document.draggg.action="dd.php?vid="+encodeURI(id)+"&storypost="+encodeURI(story);
  208. document.draggg.submit();
  209. }
  210. function deleteBox(id){
  211. document.getElementById(id).value = '';
  212. getSort();
  213. document.draggg.submit();
  214. }
  215.  
  216. function load() {
  217. document.forms[0].txtlist8.focus();
  218. }
  219. //-->
  220. </script>
  221. </head>
  222. <body onload="load();">
  223. <form action="" name="draggg" id="draggg" method="post">
  224.  
  225. <table width=95% cellpadding=0 cellspacing="0" border="0" align="center" style="cursor:pointer;"><tr><td>Today's News:</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td width="50%">Label:</td><td>URL</td></tr></table>
  226. <table cellpadding=0 cellspacing="0" border="0" width="690px">
  227. <tr>
  228. <td width="690px">
  229. <ul name="center" id="center" class="sortable boxy" style="width:690px">
  230. <?
  231. $j=1;
  232. $r = mysql_query("select * from todays_news where uid=".$_REQUEST['uid']);
  233. while($rw = mysql_fetch_array($r)){
  234. if($rw['label']!=""){
  235. echo '<li name="list'.$j.'" id="list'.$j.'" value="'.$j.'" style="width:690px"><div name="list'.$j.'" id="list'.$j.'" value="'.$j.'"><table border="0" cellpadding=0 cellspacing="0" width=100%><tr><td><input type="text" class="form-text" style="width:24em;" value="'.$rw['label'].'" name="txtlist'.$j.'" id="txtlist'.$j.'"></td><td width="10">&nbsp;</td><td><strong><a href="#"><span><input type="text" class="form-text" style="width:24em;" value="'.$rw['url'].'" id="txturllist'.$j.'" name="txturllist'.$j.'"></span></a></strong></td><td><a href="#" onclick="deleteBox(\'list'.$j.'\');">X</a></td></tr></table></div></li>';
  236. $j++;
  237. }
  238. }
  239. for($k=$j;$k<=8;$k++){
  240. echo '<li name="list'.$k.'" id="list'.$k.'" value="'.$k.'" style="width:690px"><div name="list'.$k.'" id="list'.$k.'" value="'.$k.'"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><input type="text" name="txtlist'.$k.'" id="txtlist'.$k.'" value="" class="form-text" style="width:24em;"></td><td width="10">&nbsp;</td><td><strong><a href="#"><span><input type="text" name="txturllist'.$k.'" id="txturllist'.$k.'" value="" class="form-text" style="width:24em;"></span></a></strong></td><td><a href="#" onclick="deleteBox(\'list'.$k.'\');">X</a></td></tr></table></div></li>';
  241. }
  242. ?>
  243. </ul>
  244. </td>
  245. </tr>
  246. </table>
  247.  
  248.  
  249. <br/>
  250. <input type="hidden" name="order" id="order" value="" />
  251. <input type="hidden" name="uid" id="uid" value="<?echo $_REQUEST['uid'];?>" />
  252. <input type="submit" class="form-submit" onclick="getSort()" value="Update Order" />
  253. </form>
  254. </body>
  255. </html>
Jul 20 '07 #4
atram
4
hi ...

welcome to TSDN ...

please post some code concerning your problem ... show how you add the event-handlers ...

kind regards
Hi, Mr gits i posted my code can u help me in solving that problem
thanks
Jul 20 '07 #5
atram
4
Hi, Mr gits i posted my code can u help me in solving that problem
thanks
HI,
At last i found solution for the above problem the solution is like this

we need to place this code onClick="this.focus();" in that particulor textbox then the things will work perfectly without any side effects.
thanks&regards
Jul 20 '07 #6
gits
5,390 Expert Mod 4TB
HI,
At last i found solution for the above problem the solution is like this

we need to place this code onClick="this.focus();" in that particulor textbox then the things will work perfectly without any side effects.
thanks&regards
heya atram,

glad you got it working and ... may be i don't get it but when you click on the textbox it will get the focus automaticly ... why do you set the focus explicitly again?

kind regards ...

ps: please check your PMs and send a reply to me
Jul 20 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Albinas | last post by:
Hi all, I am trying to customize the text box to suit the practice of my app. And I am working about the focus behavior of text field. I have met the the following problem. When I set the...
0
by: Jonas L | last post by:
Hi, I need to create a textbox which acts as a normal textbox but with the following extra requirements: 1) In-focus color, when the textbox gets focus the backcolor property of the textbox...
2
by: Jesper | last post by:
Last week I posted this for the first time. However, I didn't get any useable solution to my problem. I'm very keen on getting this problem solved, so please excuse me for trying again. I'll try to...
7
by: joey.powell | last post by:
I have a home page with username and password textboxes and a login button for purposes of users being able to log in (forms authentication) directly on the site home page. I also have a dedicated...
5
by: Tosch | last post by:
I have a usercontrol with a label, a textbox, a treeview, a grid and a couple of checkboxes. The usercontrol is hosted on a form together with a cancel and a accept button. This form is used to...
2
by: Agnes | last post by:
When the textbox 's Enabled = True, (its backcolor is white) When the Textbox got focus (backcolor change to pink by my code) when the textbox lost focus(back color change to white by my code)...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers...
21
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button is the Cancel button. WHen the user clicks on...
5
by: =?Utf-8?B?QmVuIFIu?= | last post by:
Hi, In a .NET 2.0 winforms application, I've got a textbox that, when updated, uses the validated event to cascade the change to another textbox (along with another value). This works well if...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.