[Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread T.J. Crowder
> It's kind of risky to try to observe the blur event from above the  
> element, because IE has serious trouble with bubbling form inputs. The  

Well, it's not that it has *trouble* with bubbling `blur` and `focus`
events. It just doesn't do it. ;-) It does, however, bubble its
proprietary `focusout` and `focusin` events.[1] That's how some
libraries provide support for `blur` and `focus` in their delegation
stuff, by using whatever the browser has that works.

[1] http://msdn.microsoft.com/en-us/library/ms536936(v=vs.85).aspx

FWIW,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Apr 4, 7:57 pm, Walter Lee Davis  wrote:
> On Apr 4, 2011, at 2:37 PM, Joschi Cassel wrote:
>
> > Question, Let's say you had a div / table with multiple inputs, do  
> > you manually set the onblur for each input or "observe" from the  
> > form, div?
>
> It's kind of risky to try to observe the blur event from above the  
> element, because IE has serious trouble with bubbling form inputs. The  
> Form.Element.Observer and Form.Observer frameworks are there to work  
> around this problem. Have a look through the documentation.
>
> If you wanted to do this yourself in an unobtrusive manner, you could  
> set an observer on each element long-hand, like this:
> document.observe('dom:loaded', function(){
>         ['field1','field2','field3'].each(function(elm){
>                 $(elm).observe('blur',function(evt){
>                         //do your stuff here,
>                         //this == your element,
>                         //evt == the blur event
>                 });
>         });
>
> });
>
> Walter

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread Walter Lee Davis


On Apr 4, 2011, at 2:37 PM, Joschi Cassel wrote:

Question, Let's say you had a div / table with multiple inputs, do  
you manually set the onblur for each input or "observe" from the  
form, div?



It's kind of risky to try to observe the blur event from above the  
element, because IE has serious trouble with bubbling form inputs. The  
Form.Element.Observer and Form.Observer frameworks are there to work  
around this problem. Have a look through the documentation.


If you wanted to do this yourself in an unobtrusive manner, you could  
set an observer on each element long-hand, like this:

document.observe('dom:loaded', function(){
['field1','field2','field3'].each(function(elm){
$(elm).observe('blur',function(evt){
//do your stuff here,
//this == your element,
//evt == the blur event
});
});
});

Walter

--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread Joschi Cassel
Gotcha.  In this case I used it to store the unique ID of the entry in the
sql table. Referencing it when an input from that row was updated.  Or as a
process of saving changes.  Example for each table row, check for input
changes, use id to write xml string to send to server side for processing.
I'll revisit it.  I was struggling a bit with onblur and bubbling.

Question, Let's say you had a div / table with multiple inputs, do you
manually set the onblur for each input or "observe" from the form, div?

Best regards,
Joschi

On Mon, Apr 4, 2011 at 10:06 AM, T.J. Crowder wrote:

> Hi,
>
> > What is your preferred method when populating a table with
> > results from a query?
>
> If I absolutely, positively must have an `id` for something where the
> value might start with a digit, I simply put an 'x' in front of it,
> then use `.substring(1)` later to get the real value.
>
> But that's only if I really need an ID. As Richard said, usually one
> doesn't need or want to assign an ID to every row in a table...
>
> -- T.J. :-)
>
> On Apr 3, 8:14 pm, Joschi Cassel  wrote:
> > I do recall that now.  Thank you.  It just fits so perfectly to use
> > the ID of the sql table row as the ID of the matching HTML table
> > row :)  What is your preferred method when populating a table with
> > results from a query?
> >
> > Thank you,
> > Joschi
> >
> > On Apr 3, 9:20 am, "T.J. Crowder"  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > Don't start `id` values with digits, it's not valid in CSS[1] (and
> > > therefore not in CSS selectors, such as those used by `select` or `$
> > > $`).
> >
> > > This is true of HTML4 as well[2], but HTML5 opens this up[3] such that
> > > an ID can be just about anything that doesn't have a space in it.
> >
> > > [1]http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
> > > [2]http://www.w3.org/TR/html401/types.html#type-id
> > > [3]http://www.w3.org/TR/html5/elements.html#concept-id
> >
> > > HTH,
> > > --
> > > T.J. Crowder
> > > Independent Software Engineer
> > > tj / crowder software / com
> > > www / crowder software / com
> >
> > > On Apr 2, 9:53 pm, Joschi Cassel  wrote:
> >
> > > > Hi all,
> > > >   Having an odd element.select issue.  I am using .select("input") on
> > > > a table row.  If the ID of the row starts with a number ("01CA5BE1-
> > > > BA6C-45AB-B46B-C3F25ACF003A" is id value), .select(input) returns
> > > > error below.
> >
> > > > [Exception... "An invalid or illegal string was specified" code: "12"
> > > > nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://
> > > > localhost/a1_local/v3/js/prototype.js Line: 3301"]
> >
> > > > Any suggestions?
> >
> > > > Best regards,
> > > > Joschi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptaculous@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread T.J. Crowder
Hi,

> What is your preferred method when populating a table with
> results from a query?

If I absolutely, positively must have an `id` for something where the
value might start with a digit, I simply put an 'x' in front of it,
then use `.substring(1)` later to get the real value.

But that's only if I really need an ID. As Richard said, usually one
doesn't need or want to assign an ID to every row in a table...

-- T.J. :-)

On Apr 3, 8:14 pm, Joschi Cassel  wrote:
> I do recall that now.  Thank you.  It just fits so perfectly to use
> the ID of the sql table row as the ID of the matching HTML table
> row :)  What is your preferred method when populating a table with
> results from a query?
>
> Thank you,
> Joschi
>
> On Apr 3, 9:20 am, "T.J. Crowder"  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Don't start `id` values with digits, it's not valid in CSS[1] (and
> > therefore not in CSS selectors, such as those used by `select` or `$
> > $`).
>
> > This is true of HTML4 as well[2], but HTML5 opens this up[3] such that
> > an ID can be just about anything that doesn't have a space in it.
>
> > [1]http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
> > [2]http://www.w3.org/TR/html401/types.html#type-id
> > [3]http://www.w3.org/TR/html5/elements.html#concept-id
>
> > HTH,
> > --
> > T.J. Crowder
> > Independent Software Engineer
> > tj / crowder software / com
> > www / crowder software / com
>
> > On Apr 2, 9:53 pm, Joschi Cassel  wrote:
>
> > > Hi all,
> > >   Having an odd element.select issue.  I am using .select("input") on
> > > a table row.  If the ID of the row starts with a number ("01CA5BE1-
> > > BA6C-45AB-B46B-C3F25ACF003A" is id value), .select(input) returns
> > > error below.
>
> > > [Exception... "An invalid or illegal string was specified" code: "12"
> > > nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://
> > > localhost/a1_local/v3/js/prototype.js Line: 3301"]
>
> > > Any suggestions?
>
> > > Best regards,
> > > Joschi

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread Joschi Cassel
Clever approach.  Thank you.

Best regards,
Joschi

On Apr 4, 5:11 am, Richard Quadling  wrote:
> On 3 April 2011 20:14, Joschi Cassel  wrote:
>
> > I do recall that now.  Thank you.  It just fits so perfectly to use
> > the ID of the sql table row as the ID of the matching HTML table
> > row :)  What is your preferred method when populating a table with
> > results from a query?
>
> > Thank you,
> > Joschi
>
> If I'm building a table to hold multiple rows, then I don't use IDs at
> all as the IDs will change for every row/page being viewed, so all the
> build-up/tear-down for every pagination would seem to be redundant.
>
> Instead, I'd code the client to rely on bubbled events so that I only
> need to add 1 event to the container that won't change for each
> pagination.
>
> My input tag names would be along the lines of ...
>
> name="tableName[id][column1Name]"
>
> That way, when they get to PHP, I have a nested array of data which
> matches the structure of the data I would need to insert into the DB
> as well as the structure of the data I would get from the DB.
>
> So, 1 pattern of coding logic.
>
> foreach($_POST['tableName'] as $i_ID => $a_Row) {
>   // Validate data
>   // $i_ID === int > 0
>   // $a_Row['column1Name'] === string / regex / etc.
>
>   // Process row.
>
> }
>
> Sort of thing.
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread Richard Quadling
On 3 April 2011 20:14, Joschi Cassel  wrote:
> I do recall that now.  Thank you.  It just fits so perfectly to use
> the ID of the sql table row as the ID of the matching HTML table
> row :)  What is your preferred method when populating a table with
> results from a query?
>
> Thank you,
> Joschi
>

If I'm building a table to hold multiple rows, then I don't use IDs at
all as the IDs will change for every row/page being viewed, so all the
build-up/tear-down for every pagination would seem to be redundant.

Instead, I'd code the client to rely on bubbled events so that I only
need to add 1 event to the container that won't change for each
pagination.

My input tag names would be along the lines of ...

name="tableName[id][column1Name]"

That way, when they get to PHP, I have a nested array of data which
matches the structure of the data I would need to insert into the DB
as well as the structure of the data I would get from the DB.

So, 1 pattern of coding logic.

foreach($_POST['tableName'] as $i_ID => $a_Row) {
  // Validate data
  // $i_ID === int > 0
  // $a_Row['column1Name'] === string / regex / etc.

  // Process row.
}


Sort of thing.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: strange element.select issue

2011-04-03 Thread Walter Lee Davis
I prepend something known and meaningless, like row_ to the numerical  
ID. Then I strip that off with slice or split('_').last() when I need  
to use it later. Frameworks like Scriptaculous Sortable do that for  
you as well, when you serialize a sortable table, you are required to  
have the IDs set like that, with a prefix, underscore, and number.


Walter

On Apr 3, 2011, at 3:14 PM, Joschi Cassel wrote:


I do recall that now.  Thank you.  It just fits so perfectly to use
the ID of the sql table row as the ID of the matching HTML table
row :)  What is your preferred method when populating a table with
results from a query?

Thank you,
Joschi

On Apr 3, 9:20 am, "T.J. Crowder"  wrote:

Hi,

Don't start `id` values with digits, it's not valid in CSS[1] (and
therefore not in CSS selectors, such as those used by `select` or `$
$`).

This is true of HTML4 as well[2], but HTML5 opens this up[3] such  
that

an ID can be just about anything that doesn't have a space in it.

[1]http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
[2]http://www.w3.org/TR/html401/types.html#type-id
[3]http://www.w3.org/TR/html5/elements.html#concept-id

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Apr 2, 9:53 pm, Joschi Cassel  wrote:


Hi all,
  Having an odd element.select issue.  I am using .select("input")  
on

a table row.  If the ID of the row starts with a number ("01CA5BE1-
BA6C-45AB-B46B-C3F25ACF003A" is id value), .select(input) returns
error below.


[Exception... "An invalid or illegal string was specified" code:  
"12"

nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://
localhost/a1_local/v3/js/prototype.js Line: 3301"]



Any suggestions?



Best regards,
Joschi


--
You received this message because you are subscribed to the Google  
Groups "Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com 
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en 
.




--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: strange element.select issue

2011-04-03 Thread Joschi Cassel
Must be because it works well otherwise.  Thank you for responding.

On Apr 3, 9:28 am, Jonathan Rosenberg  wrote:
> Technically, an I'd cannot start with a digit.  Maybe this is the problem?
>  On Apr 2, 2011 4:53 PM, "Joschi Cassel"  wrote:
>
> > Hi all,
> > Having an odd element.select issue. I am using .select("input") on
> > a table row. If the ID of the row starts with a number ("01CA5BE1-
> > BA6C-45AB-B46B-C3F25ACF003A" is id value), .select(input) returns
> > error below.
>
> > [Exception... "An invalid or illegal string was specified" code: "12"
> > nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://
> > localhost/a1_local/v3/js/prototype.js Line: 3301"]
>
> > Any suggestions?
>
> > Best regards,
> > Joschi
>
> > --
> > You received this message because you are subscribed to the Google Groups
>
> "Prototype & script.aculo.us" group.> To post to this group, send email to
>
> prototype-scriptaculous@googlegroups.com.> To unsubscribe from this group, 
> send email to
>
> prototype-scriptaculous+unsubscr...@googlegroups.com.> For more options, 
> visit this group at
>
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: strange element.select issue

2011-04-03 Thread Joschi Cassel
I do recall that now.  Thank you.  It just fits so perfectly to use
the ID of the sql table row as the ID of the matching HTML table
row :)  What is your preferred method when populating a table with
results from a query?

Thank you,
Joschi

On Apr 3, 9:20 am, "T.J. Crowder"  wrote:
> Hi,
>
> Don't start `id` values with digits, it's not valid in CSS[1] (and
> therefore not in CSS selectors, such as those used by `select` or `$
> $`).
>
> This is true of HTML4 as well[2], but HTML5 opens this up[3] such that
> an ID can be just about anything that doesn't have a space in it.
>
> [1]http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
> [2]http://www.w3.org/TR/html401/types.html#type-id
> [3]http://www.w3.org/TR/html5/elements.html#concept-id
>
> HTH,
> --
> T.J. Crowder
> Independent Software Engineer
> tj / crowder software / com
> www / crowder software / com
>
> On Apr 2, 9:53 pm, Joschi Cassel  wrote:
>
> > Hi all,
> >   Having an odd element.select issue.  I am using .select("input") on
> > a table row.  If the ID of the row starts with a number ("01CA5BE1-
> > BA6C-45AB-B46B-C3F25ACF003A" is id value), .select(input) returns
> > error below.
>
> > [Exception... "An invalid or illegal string was specified" code: "12"
> > nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://
> > localhost/a1_local/v3/js/prototype.js Line: 3301"]
>
> > Any suggestions?
>
> > Best regards,
> > Joschi

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: strange element.select issue

2011-04-03 Thread T.J. Crowder
Hi,

Don't start `id` values with digits, it's not valid in CSS[1] (and
therefore not in CSS selectors, such as those used by `select` or `$
$`).

This is true of HTML4 as well[2], but HTML5 opens this up[3] such that
an ID can be just about anything that doesn't have a space in it.

[1] http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
[2] http://www.w3.org/TR/html401/types.html#type-id
[3] http://www.w3.org/TR/html5/elements.html#concept-id

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Apr 2, 9:53 pm, Joschi Cassel  wrote:
> Hi all,
>   Having an odd element.select issue.  I am using .select("input") on
> a table row.  If the ID of the row starts with a number ("01CA5BE1-
> BA6C-45AB-B46B-C3F25ACF003A" is id value), .select(input) returns
> error below.
>
> [Exception... "An invalid or illegal string was specified" code: "12"
> nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://
> localhost/a1_local/v3/js/prototype.js Line: 3301"]
>
> Any suggestions?
>
> Best regards,
> Joschi

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.