473,378 Members | 1,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Disable drag in ie & FF

Im not sure if this is the group to post in, if anyone knows a more
appropriate one please let me know.

Please consider the following example of a feature most all browsers
have that I would like to either disable or find a work around for.

Background:
I have a form that has 3 input type="text" fields. The fields are
Quantity, Amount and total. OnKeyUp is used when you enter something in
Quantity or Amount to trigger a javaScript function that makes a
calculation and updates the total field.

The total field is "locked" with onFocus=this.blur so that the totals
cannot be entered by the end user. I did not use disable because when
the form is submitted I had problems with asp form collection of
disabled form elements.

Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.

2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.

The client "must have" the calculations being done real time so the
people entering the time can see the total entered.

Any ideas on working around this would be greatly appreciated.

Earl

Nov 25 '06 #1
9 10260
surf_doggie wrote:
Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.

2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.

The client "must have" the calculations being done real time so the
people entering the time can see the total entered.

If you absolutely have to have a total field for your submit form,
consider making it hidden. Next use a <div id=someIDor <span
id=someIDto hold your totals, then when you calculate your totals,
after you update the value in your hidden field just do
document.getElementById("someID").innerHTML = newtotal;

This eliminates the problem by preventing total from being an input
field and making it a part of the web page itself.
---------------------------------------------------------------------------
http://www.hunlock.com -- Permanently under construction (And proud of it!)
$FA
Nov 25 '06 #2
Client wants the people to be able to see the totals before they submit
so hidden total is not an option, if it were I wouldnt calculate with
JS would do it server side. Its a good idea and I would do it but its
not an option in this situation.

pcx99 wrote:
surf_doggie wrote:
Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.

2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.

The client "must have" the calculations being done real time so the
people entering the time can see the total entered.


If you absolutely have to have a total field for your submit form,
consider making it hidden. Next use a <div id=someIDor <span
id=someIDto hold your totals, then when you calculate your totals,
after you update the value in your hidden field just do
document.getElementById("someID").innerHTML = newtotal;

This eliminates the problem by preventing total from being an input
field and making it a part of the web page itself.
---------------------------------------------------------------------------
http://www.hunlock.com -- Permanently under construction (And proud of it!)
$FA
Nov 25 '06 #3
surf_doggie wrote:
Client wants the people to be able to see the totals before they submit
so hidden total is not an option, if it were I wouldnt calculate with
JS would do it server side. Its a good idea and I would do it but its
not an option in this situation.
As I said. Make the total input field hidden but create a <divor
<spanon the web page and use DHTML to insert the new total directly
into the web page. This prevents the total from being a visible
textbox and makes the total a part of the web page itself just like any
other text.
Nov 25 '06 #4

pcx99 wrote:
surf_doggie wrote:
Client wants the people to be able to see the totals before they submit
so hidden total is not an option, if it were I wouldnt calculate with
JS would do it server side. Its a good idea and I would do it but its
not an option in this situation.

As I said. Make the total input field hidden but create a <divor
<spanon the web page and use DHTML to insert the new total directly
into the web page. This prevents the total from being a visible
textbox and makes the total a part of the web page itself just like any
other text.
I see said the blind man. I will test that out but what about the
function not firing when you use the copy feature mentioned above to
move one amount to another amount field?

Nov 25 '06 #5

surf_doggie wrote:
pcx99 wrote:
surf_doggie wrote:
Client wants the people to be able to see the totals before they submit
so hidden total is not an option, if it were I wouldnt calculate with
JS would do it server side. Its a good idea and I would do it but its
not an option in this situation.
As I said. Make the total input field hidden but create a <divor
<spanon the web page and use DHTML to insert the new total directly
into the web page. This prevents the total from being a visible
textbox and makes the total a part of the web page itself just like any
other text.

I see said the blind man. I will test that out but what about the
function not firing when you use the copy feature mentioned above to
move one amount to another amount field?
Never mind testing all the fields this way. Will repost shortly

Nov 25 '06 #6
"surf_doggie" <ea*******@gmail.comwrites:
I have a form that has 3 input type="text" fields. The fields are
Quantity, Amount and total. OnKeyUp is used when you enter something in
Quantity or Amount to trigger a javaScript function that makes a
calculation and updates the total field.

The total field is "locked" with onFocus=this.blur so that the totals
cannot be entered by the end user. I did not use disable because when
the form is submitted I had problems with asp form collection of
disabled form elements.
What is the oldest browser you're trying to support? You can simply
disable an input control with disabled="disabled" in the HTML or with
control.disabled=true in JS. Also, as pcx suggested, why not use a div
to display the result of your calculation?
Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.
You can disable drag and drop in IE by handling two non-standard
events, ondragover and ondrop. In FF, to the best of my knowledge, you
can't override default DnD behaviors unless you use XUL to describe at
least part of your document.

In any case, I have a feeling that you don't need to deal with DnD as
such, just as long as the element you use to display your results is
not an input or is disabled.
2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.
Are you using onkeyup? Try onchange.

Ari.
--
Elections only count as free and trials as fair if you can lose money
betting on the outcome.
Nov 25 '06 #7

Ari Krupnik wrote:
"surf_doggie" <ea*******@gmail.comwrites:
I have a form that has 3 input type="text" fields. The fields are
Quantity, Amount and total. OnKeyUp is used when you enter something in
Quantity or Amount to trigger a javaScript function that makes a
calculation and updates the total field.

The total field is "locked" with onFocus=this.blur so that the totals
cannot be entered by the end user. I did not use disable because when
the form is submitted I had problems with asp form collection of
disabled form elements.

What is the oldest browser you're trying to support? You can simply
disable an input control with disabled="disabled" in the HTML or with
control.disabled=true in JS. Also, as pcx suggested, why not use a div
to display the result of your calculation?
Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.

You can disable drag and drop in IE by handling two non-standard
events, ondragover and ondrop. In FF, to the best of my knowledge, you
can't override default DnD behaviors unless you use XUL to describe at
least part of your document.

In any case, I have a feeling that you don't need to deal with DnD as
such, just as long as the element you use to display your results is
not an input or is disabled.
2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.

Are you using onkeyup? Try onchange.

Ari.
--
Elections only count as free and trials as fair if you can lose money
betting on the outcome.
I tried the onchange but when dragging from an amount field to an
amount field it does not fire the function

Nov 25 '06 #8
Figured it out

<input name="expQuant0" type="text" size="2" value="1"
onKeyUp="calc_Exp(this.name,this.value,event);"
onFocus="clearbox(this.name,this.value);"
onBlur="setbox(this.name,this.value,'exp');" ondragstart="return
false;" >

Key is to add ondragstart="return false;" that you dont want dragable.

Thanks,
Earl

surf_doggie wrote:
Ari Krupnik wrote:
"surf_doggie" <ea*******@gmail.comwrites:
I have a form that has 3 input type="text" fields. The fields are
Quantity, Amount and total. OnKeyUp is used when you enter something in
Quantity or Amount to trigger a javaScript function that makes a
calculation and updates the total field.
>
The total field is "locked" with onFocus=this.blur so that the totals
cannot be entered by the end user. I did not use disable because when
the form is submitted I had problems with asp form collection of
disabled form elements.
What is the oldest browser you're trying to support? You can simply
disable an input control with disabled="disabled" in the HTML or with
control.disabled=true in JS. Also, as pcx suggested, why not use a div
to display the result of your calculation?
Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.
You can disable drag and drop in IE by handling two non-standard
events, ondragover and ondrop. In FF, to the best of my knowledge, you
can't override default DnD behaviors unless you use XUL to describe at
least part of your document.

In any case, I have a feeling that you don't need to deal with DnD as
such, just as long as the element you use to display your results is
not an input or is disabled.
2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.
Are you using onkeyup? Try onchange.

Ari.
--
Elections only count as free and trials as fair if you can lose money
betting on the outcome.

I tried the onchange but when dragging from an amount field to an
amount field it does not fire the function
Nov 26 '06 #9
ASM
surf_doggie a écrit :
what about the
function not firing when you use the copy feature mentioned above to
move one amount to another amount field?

Quantity : <input onchange="calculate()" blah />

or if you think it's better :

<input onkeyup="calculate()" onchange="calculate()" blah />
or
<input onkeyup="calculate()" onmouseup="calculate()" blah />

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Contact : http://stephane.moriaux.perso.wanadoo.fr/contact
ASM = Aimable Stéphane Moriaux = Amateur Sasseur Merdouilles
Nov 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ryan Stewart | last post by:
If you don't want to read this post because of its length, I understand. I've spent two and a half days on this problem and have a good deal of information to relate. And this is kind of a long...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
2
by: Dolorous Edd | last post by:
Hi, for a program I'm working on I need to be able to drag multiple files between Windows Explorer and a ListBox, in both directions. Implementing the "drag in" was pretty easy, but I can't find...
2
by: khng | last post by:
How to disable the copy/drag event for some selected textfield as I want the user to key in instead of copy or drag the required information. For IE, I done it with the onPaste and onDragEnter...
1
by: Jason | last post by:
Does anyone know how to disable selecting when drawing VML objects? I have a sketchpad program, where I draw polylines when you do a mouse drag. The problem is that when i drag the mouse, it is...
4
by: Vincent | last post by:
I have created a drag and drop scheduler within Microsoft access. One of our bug testers was doing some testing and noticed that the drag and drop gets messed up if they press both the left and...
5
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
18
by: mclerp | last post by:
I want to disable copying picture files from an HTML file. I have purchased "Activ eBook Compiler" software which disables left-click copying, printing, and Alt+PrtScr copying to clipboard but it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.