[Phpwm] [OT]event trigger

David Goodwin david at codepoets.co.uk
Wed Mar 14 20:20:34 GMT 2007


Phil Beynon wrote :
> > > Does anyone know how to get a javascript on-event trigger to fire from a
> > > right click menu paste into a form input field?
> > > I'd have thought that a set focus on window load might have done it, but
> > > it
> > > didnt!
> > > It works fine on typing into the field and ctrl V.
> > >
> > > I Googled it for a bit but didn't see anything conclusive.
> > >
> > >
> > > Regards,
> > >
> > > Phil Beynon
> >
> > I'm not sure I know exactly what you're asking, although this might help.
> >
> > I don't believe you can specify an event as details as to which item they
> > press in after using the right mouse button.
> > Perhaps this solves some of your problem though:
> > http://www.w3schools.com/js/tryit.asp?filename=try_dom_event_button is an
> > example to work out which mouse button was pressed. Then whatever you'd do
> > after that would be much the same as before.
> >
> > >From Paul.
> 
> I am so stupid sometimes......
> 
> I have two pretty much identical forms on the page concerned, one for adding
> a record, the other for editing - I was adding on-events to one and testing
> the effect on the other form!
> 
> This works now;
> 
> <input name="group_name" class="MedInput" type="text" value="<?php echo
> $myrow["group_name"]; ?>" size="50" maxlength="50"
> onfocus="textCounter(this,'progressbar2',50);FldVal(document.formthree);"
> onKeyDown="textCounter(this,'progressbar2',50)"
> onKeyUp="textCounter(this,'progressbar2',50);FldVal(document.formthree);"
> onMouseDown="textCounter(this,'progressbar2',50);FldVal(document.formthree);
> "
> onMouseOver="textCounter(this,'progressbar2',50);FldVal(document.formthree);
> "
> onMouseOut="textCounter(this,'progressbar2',50);FldVal(document.formthree);"
> >
> <div id="progressbar2" class="progress"></div>
> <script>textCounter(document.getElementById("group_name"),"progressbar2",50)
> </script>
> 
> Which if anyone wants the source is a routine that does a text counter
> bargraph / submit disable until required field(s) populated / disable after
> submit.
> 

By which I presume you mean you get a bar that says, e.g. the form is
90% complete?

I don't know much about Javascript, but I seem to keep hearing from
others that it's best to not include Javascript inline with HTML, and
instead 'attach' listeners (or whatever they're called) by loading
relevant JS files in the <head> </head>..... Paul can/might/could say
more about such things.

David.

-- 
David Goodwin 

[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk       ]



More information about the Phpwm mailing list