472,373 Members | 1,990 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,373 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 10168
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...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.