# OnDrag fired with smartclient, but not with webclient

**URL:** https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107
**Category:** Classic Servoy
**Created:** [March 11, 2013, 4:06pm UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107 "2013-03-11T16:06:49Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [March 11, 2013, 4:06pm UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/1 "2013-03-11T16:06:49Z")

</div>

I tried drag and drop in the Developer / Version: 6.1.2 - build 1421 (browser Chrome):

- with smartclient it works a expected
- with webclient I have no reaction, just nothing happends when I drag

I Tested with the following Statement (same codebase for web and smart):

function onDrag(event) {  
application.output(‘Ondrag…’ + event.getSource())  
}

Any Idea what I do wrong ?  
Thanks

---

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [March 12, 2013, 7:02am UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/2 "2013-03-12T07:02:46Z")

</div>

- maybe an option or something that turns off DnD ?

- or ist drag and drop working only for smartclient, but not for the webclient ?

- or only on the server but not in developer (have now not ready the server / database to test it) ?

---

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [April 3, 2013, 2:00pm UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/3 "2013-04-03T14:00:26Z")

</div>

After weeks of no answer…

I made a little test.servoy with only 2 fields an all the drag and drop routines, and it seems to be like I presume:

The webclient doesn’t fire the onDrag-, onDragOver-, onDrop-Routines !

Can please somebody from servoy confirm that drag and drop only works with smartclient ?

[attachment=0]Test.servoy[/attachment]

[Test.servoy](https://forum.servoy.com/uploads/short-url/qcekxAJ0MOtELVvIvcECk4lScgr.servoy) (6.4 KB)

---

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [April 8, 2013, 8:23am UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/4 "2013-04-08T08:23:17Z")

</div>

… after another week

Who has ever done drag and drop with WEBclient ? Was it working in earlier versions ?

Thank you for any feedback. I feel quit alone after on month with no answers… ![:cry:]( "Crying or Very sad")

---

<div class="post-metadata">

### Author: ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)
#### Post date: [April 9, 2013, 11:52am UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/5 "2013-04-09T11:52:01Z")

</div>

I think what you are trying to do here is a bit strange (dragging a text field). I have tested your solution and I can drag for example the label containing “DRAG THIS FIELD TO THE NEXT FIELD” anywhere just fine. I can also drag the text field, but only if I click and drag exactly on the field’s border. I guess that happens because most browsers support dragging text by default, so that might interfere.

I’d say the 95% use case of drag & drop in Servoy is dragging records from one table to another…

---

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [April 10, 2013, 9:50am UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/6 "2013-04-10T09:50:55Z")

</div>

Patrick, very helpfull, thank you a lot !

I created a bad example (textfield) which really didn’t work. This gave me the “allegedly endorsement” that DnD is not working in Webclient…

With the positive reinforcement of your help I did a again closer look to my solution and found the problem only exist on buttons:

if I use a button, drag n drop works with smartclient, but not with webclient !

Why I use button ? I just put a label on my form, add an onAction-property an the label changes to a button !

If I use “label” I can drag and drop, but not click.  
If I use “button” I can click, but not drag and drop.

How can I make the colered day-fields on my calendar dragable an clickable ?  
[http://www.dsug.eu/forum/index.php?page=Attachment&attachmentID=120](http://www.dsug.eu/forum/index.php?page=Attachment&attachmentID=120)

---

<div class="post-metadata">

### Author: ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)
#### Post date: [April 10, 2013, 10:49am UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/7 "2013-04-10T10:49:52Z")

</div>

Hm. But isn’t that a bit strange design wise? I can click on a button and something fires. I can also drag the button around. I guess the problem is that in the browser, the mouse click is simply used as button action. What does the click do in this calendar? And: you can probably drag the button if you grab exactly the border of it…

---

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [April 10, 2013, 12:51pm UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/8 "2013-04-10T12:51:30Z")

</div>

Patrick,

The user doesn’t recognize the button as a button, but as a “day-field”.

Try this php-demo and click on any of the days (no mather an empty day, ore a colored one):  
[http://www.gigdoodle.ch/Gigd.php?Dirl=mao8mt81pdcouppj6a0q6bbis6](http://www.gigdoodle.ch/Gigd.php?Dirl=mao8mt81pdcouppj6a0q6bbis6)

The click in need to turn ON and OFF the days color.

The user doesn’t recognice the DnD as a “moving the button”, but as a “moving the day-mark” from one field-  
position to an other field-position (not available in this free-version of the php-demo).

For draging colored day(s) to an other position i need the drag n drop

Maybe you have a better idea then buttons, to show the colored days, let the user turn ON and OF the color, drag it  
from one position to an other position.

thanks sandro

---

<div class="post-metadata">

### Author: ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)
#### Post date: [April 11, 2013, 7:55am UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/9 "2013-04-11T07:55:18Z")

</div>

Now I get it. I think it should work if the onClick property of the button is turned off. You should be able to do both then: assign an onClick method and still drag the button.

Please file a bug report for not being able to drag a button that has the onClick property set.

---

<div class="post-metadata">

### Author: ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)
#### Post date: [April 16, 2013, 2:56pm UTC](https://forum.servoy.com/t/ondrag-fired-with-smartclient-but-not-with-webclient/17107/10 "2013-04-16T14:56:21Z")

</div>

Thank you Patrick

> **[Jira](https://servoy-cloud.atlassian.net/browse/SVY-4385)**

I tried with a html-area. This is dragable also in webclient, but I can’t display a value without a dataprovider, if I understood it right.
