Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15876 > unrolled thread
| Started by | justaguy <lichunshen84@gmail.com> |
|---|---|
| First post | 2012-09-12 13:49 -0700 |
| Last post | 2012-09-17 22:07 -0700 |
| Articles | 8 — 4 participants |
Back to article view | Back to comp.lang.javascript
How to perform two even triggers for a single INPUT field? justaguy <lichunshen84@gmail.com> - 2012-09-12 13:49 -0700
Re: How to perform two even triggers for a single INPUT field? justaguy <lichunshen84@gmail.com> - 2012-09-12 15:30 -0700
Re: How to perform two even triggers for a single INPUT field? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-09-13 07:20 +0000
Re: How to perform two even triggers for a single INPUT field? David Mark <dmark.cinsoft@gmail.com> - 2012-09-13 17:34 -0700
Re: How to perform two even triggers for a single INPUT field? justaguy <lichunshen84@gmail.com> - 2012-09-13 19:15 -0700
Re: How to perform two even triggers for a single INPUT field? dhtml <dhtmlkitchen@gmail.com> - 2012-09-15 12:55 -0700
Re: How to perform two even triggers for a single INPUT field? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-09-15 20:56 +0000
Re: How to perform two even triggers for a single INPUT field? David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 22:07 -0700
| From | justaguy <lichunshen84@gmail.com> |
|---|---|
| Date | 2012-09-12 13:49 -0700 |
| Subject | How to perform two even triggers for a single INPUT field? |
| Message-ID | <4ee18e33-627f-4113-9eb6-b2f61519ee9c@n9g2000yqn.googlegroups.com> |
Hi, What we want to do is: First, using ExtJS to get a list of items dynamically from the database, to let a user select one from them upon entering 2 characters (some calls this technique "autosuggest"), and then, submit the form for further process such as pulling more relevant data from the database per selected item. I've got the first part working, now, I'm stuck with the second event trigger, don't know how to trigger it. The FORM element may look like the following (but the onSelect even trigger does not work here). <input type="text" name="pid" id="pid" onblur="showParts();" onSelect="form.submit();"> So, how do we do this? Many thanks.
[toc] | [next] | [standalone]
| From | justaguy <lichunshen84@gmail.com> |
|---|---|
| Date | 2012-09-12 15:30 -0700 |
| Message-ID | <66b4ff5c-43d2-47e7-b9d1-c0c2d9160df9@d6g2000yqd.googlegroups.com> |
| In reply to | #15876 |
On Sep 12, 4:49 pm, justaguy <lichunshe...@gmail.com> wrote: > Hi, > > What we want to do is: > First, using ExtJS to get a list of items dynamically from the > database, to let a user select one from them upon entering 2 > characters (some calls this technique "autosuggest"), and then, submit > the form for further process such as pulling more relevant data from > the database per selected item. I've got the first part working, now, > I'm stuck with the second event trigger, don't know how to trigger it. > > The FORM element may look like the following (but the onSelect even > trigger does not work here). > <input type="text" name="pid" id="pid" onblur="showParts();" > onSelect="form.submit();"> > > So, how do we do this? > > Many thanks. Sorry for the typo in the subject line, "even" -> "event".
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-09-13 07:20 +0000 |
| Message-ID | <XnsA0CD5F0BD2902eejj99@194.109.133.133> |
| In reply to | #15879 |
justaguy wrote on 13 sep 2012 in comp.lang.javascript: > First, using ExtJS to get a What is ExtJS? Let us just talk about javascript as a language without black boxes. > <input type="text" name="pid" id="pid" onblur="showParts();" > onSelect="form.submit();"> onSelect is only applicable to a <select><option> use onfocus with <input type=text>. ============= form.submit() ? probably you mean: this.form.submit() ========== Meseems if you submit when selecting an input field, the field never is available for human input, unless you submit to a different target than the page at hand? Evenso would it not be more logical and userfriendly to submit onblur? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | David Mark <dmark.cinsoft@gmail.com> |
|---|---|
| Date | 2012-09-13 17:34 -0700 |
| Message-ID | <b1d3b2bc-8dfd-4374-bdca-012773547c5b@googlegroups.com> |
| In reply to | #15882 |
On Thursday, September 13, 2012 3:20:38 AM UTC-4, Evertjan. wrote: > justaguy wrote on 13 sep 2012 in comp.lang.javascript: > > > > > First, using ExtJS to get a > > > > What is ExtJS? A complete POS framework with lots of horrible JS and CSS inside. Wait, lots of frameworks; they rewrite it every year to "keep up" with the browsers. > > > > Let us just talk about javascript as a language without black boxes. Really a DOM question. > > > > > <input type="text" name="pid" id="pid" onblur="showParts();" > > > onSelect="form.submit();"> > > > > onSelect is only applicable to a <select><option> > > > > use onfocus with <input type=text>. That doesn't make any sense (of course, neither did the original question). It's clear that "justaguy" does not know JS/DOM well enough to be fooling around with this stuff (and ExtJS sure can't help there). Furthermore, the question is severely lacking in useful information. Likely a waste of time to continue the thread.
[toc] | [prev] | [next] | [standalone]
| From | justaguy <lichunshen84@gmail.com> |
|---|---|
| Date | 2012-09-13 19:15 -0700 |
| Message-ID | <3b71946c-2fc8-4e13-9613-a146e47856f7@r7g2000yqa.googlegroups.com> |
| In reply to | #15886 |
On Sep 13, 8:34 pm, David Mark <dmark.cins...@gmail.com> wrote:
> On Thursday, September 13, 2012 3:20:38 AM UTC-4, Evertjan. wrote:
> > justaguy wrote on 13 sep 2012 in comp.lang.javascript:
>
> > > First, using ExtJS to get a
>
> > What is ExtJS?
>
> A complete POS framework with lots of horrible JS and CSS inside. Wait, lots of frameworks; they rewrite it every year to "keep up" with the browsers.
>
>
>
> > Let us just talk about javascript as a language without black boxes.
>
> Really a DOM question.
>
>
>
> > > <input type="text" name="pid" id="pid" onblur="showParts();"
>
> > > onSelect="form.submit();">
>
> > onSelect is only applicable to a <select><option>
>
> > use onfocus with <input type=text>.
>
> That doesn't make any sense (of course, neither did the original question).
>
> It's clear that "justaguy" does not know JS/DOM well enough to be fooling around with this stuff (and ExtJS sure can't help there). Furthermore, the question is severely lacking in useful information. Likely a waste of time to continue the thread.
Well, ExtJS, a third party, javascript library, is useful but it's not
that easy to use. Yes, I don't know js and DOM well enough.
Btw, I've changed the code to make the BODY tag to load the
showParts() function.
So, how the INPUT box looks like this"
<input type="text" name="pid" id="pid">
Btw, here's showParts function that leverages the ExtJS 2.2.
function showParts() {
var autos = new Ext.form.ComboBox({
xtype: 'combo',
id: 'getDataNote',
store: new Ext.data.Store({
url: 'getParts.cfm?partnumber=',
reader:new Ext.data.JsonReader({
root:'results',
fields:['partnumberV']},
haveRecords
)
}),
mode : 'local',
displayField: 'partnumberV',
valueField: 'partnumberV',
hiddenName: 'partnumberX',
typeAhead: true,
minChars: 2,
// queryDelay: 50,
forceSelection: false,
editable: true,
selectOnFocus: false,
// emptyText: 'Type a few letters here to select or enter a new
one...',
style: {background:'#EFF9FC'},
applyTo:'partnumber'
});
autos.store.load({params:{'partnumber':'','namelike':true}});
/*
listeners:{
select:
alert('action upon select');
document.forms[0].submit();
}
*/
};
I was wondering if there's listeners or simply select method or
parameter that can be bound to
next event trigger.
Someone mentioned about the following to trigger an event upon select,
however, it's not working, that is, it's loaded upon page load.
name:'myCombo',
listeners:{
select:function(cmb,rec,index){
// do whatever you want here
}
}
What's wrong? Many thanks.
[toc] | [prev] | [next] | [standalone]
| From | dhtml <dhtmlkitchen@gmail.com> |
|---|---|
| Date | 2012-09-15 12:55 -0700 |
| Message-ID | <96382fa1-e94d-4a8c-842a-bf39c2f957ac@j2g2000pbg.googlegroups.com> |
| In reply to | #15882 |
On Sep 13, 12:20 am, "Evertjan." <exxjxw.hannivo...@inter.nl.net> wrote: > justaguy wrote on 13 sep 2012 in comp.lang.javascript: [...] > > <input type="text" name="pid" id="pid" onblur="showParts();" > > onSelect="form.submit();"> > > onSelect is only applicable to a <select><option> > That is untrue. If the user selects text in the text input, the form is submitted. That's not how users expect forms to work. It sounds like you want to implement an autocomplete widget. That's something that you could use a library like, such as ExtJS, but after reviewing ExtJS, I'd recommend against that one. YUI might be better, but IME they don't fix bugs promptly, so you'll have to fork and fix them yourself.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-09-15 20:56 +0000 |
| Message-ID | <XnsA0CFE96B54F59eejj99@194.109.133.133> |
| In reply to | #15902 |
dhtml wrote on 15 sep 2012 in comp.lang.javascript: > On Sep 13, 12:20 am, "Evertjan." <exxjxw.hannivo...@inter.nl.net> > wrote: >> justaguy wrote on 13 sep 2012 in comp.lang.javascript: > > [...] >> > <input type="text" name="pid" id="pid" onblur="showParts();" >> > onSelect="form.submit();"> >> >> onSelect is only applicable to a <select><option> >> > That is untrue. > > If the user selects text in the text input, the form is submitted. > That's not how users expect forms to work. > > It sounds like you want to implement an autocomplete widget. That's > something that you could use a library like, such as ExtJS, but after > reviewing ExtJS, I'd recommend against that one. YUI might be better, > but IME they don't fix bugs promptly, so you'll have to fork and fix > them yourself. me? why? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | David Mark <dmark.cinsoft@gmail.com> |
|---|---|
| Date | 2012-09-17 22:07 -0700 |
| Message-ID | <82871fa1-8382-42ee-b2d2-e711c3f77942@z8g2000yql.googlegroups.com> |
| In reply to | #15902 |
On Sep 15, 3:55 pm, dhtml <dhtmlkitc...@gmail.com> wrote: > On Sep 13, 12:20 am, "Evertjan." <exxjxw.hannivo...@inter.nl.net> > wrote: > > > justaguy wrote on 13 sep 2012 in comp.lang.javascript: > > [...]> > <input type="text" name="pid" id="pid" onblur="showParts();" > > > onSelect="form.submit();"> > > > onSelect is only applicable to a <select><option> > > That is untrue. > > If the user selects text in the text input, the form is submitted. > That's not how users expect forms to work. > > It sounds like you want to implement an autocomplete widget. That's > something that you could use a library like, such as ExtJS, but after > reviewing ExtJS, I'd recommend against that one. Quite. > YUI might be better, > but IME they don't fix bugs promptly, so you'll have to fork and fix > them yourself. Why would you do that? YUI is only marginally better than Ext. Auto- complete/suggest widgets are trivial if you know what you are doing (and if you don't, trying to fork/fix YUI isn't going to work for you either). Same goes for Dojo, jQuery UI and the rest of the "popular" frameworks that sell instant gratification to gullible beginners. The quest for instant gratification through libraries/frameworks often ruins Web applications. It's often done to present "impressive" results to the client during each step of development (recently described to me as an "agile" approach). Interim results are irrelevant; the end result is all that matters. You can dump in canned widgets at the beginning, losing all sight of the context and producing something that looks like it is 80% there, almost overnight. Of course, the remaining 20% required for a competent application approaches impossible at that point. The client may be fleetingly impressed by the widget, but ultimately the users will end up with a POS application. I've had clients that look over my shoulder looking for dazzling visuals at every step. I explained to them (as gently as possible) that they should wait until the end to pass judgement (after all, the users won't see it until it is done). The CSS eye candy and JS enhancements are typically done near the end, so sometimes clients get antsy looking at the relatively dull interim results.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web