fieldset: implicit "id" property ?

1 view
Skip to first unread message

Dan Connelly

unread,
Jan 5, 2008, 8:24:48 AM1/5/08
to Appcelerator Platform SDK
Am I supposed to use the value of the "id" property to distinguish
among the possible fieldsets on the page? If so, it should be the
fieldset name.

Is there some standard use for "id"? Does the value have a meaning?

Nolan Wright

unread,
Jan 5, 2008, 10:26:11 AM1/5/08
to Appcelerator Platform SDK
I'm not sure I understand your question, but here's some info on
fieldsets:

they are used to link input fields together for the purpose of sending
a message. When a message is generated by a member of a fieldset, we
place all of the values of the fields that share the same fieldset
name (e.g., fieldset="my_form"). When setting the message payload we
look at the "id" value to set the name portion of the name/value
pair. You should also be able to use "name" as well. Here's an
example:

<input type="text" name="username" fieldset="login"/>
<input type="password" id="password" fieldset="login"/>
<input type="button" fieldset="login" on="click then r:login.request"/
>

In the example above the message payload would have
{'username':'value', 'password':'value'}.

Not sure if this answers your question. If not, can you provide me
with some additional detail?

Thanks.
Nolan

Dan Connelly

unread,
Jan 5, 2008, 12:30:34 PM1/5/08
to appcelerator...@googlegroups.com
Nolan:

My question is due to the fact the payload for your example will not be the JSON you give.   It will actually be:
{'id':'app_20', 'username':'value', 'password':'value'}
The "id" property will appear in the payload although there is no 'id' input in the fieldset.

Just run the Fieldsets Example in the Appcelerator documentation and you will see this.   Value is usually app_xx where xx is numeric.    I have no idea if this value is meaningful or predictable.   I have no idea how to suppress it.

Maybe the 'id' property is a bug, since neither one of us expected it.

       -- Dan Connelly

Nolan Wright

unread,
Jan 5, 2008, 12:42:10 PM1/5/08
to Appcelerator Platform SDK
I understand your question now. We include the id of the element that
generates the message in the message payload. The "app_20" is the id
that we assigned to the element that generated your message. If an
element does not have an "id" defined, we define one for it.

I seem to recall that there is a way to suppress a fieldset member
from the message payload. Let me take a look.


On Jan 5, 12:30 pm, Dan Connelly <daniel.s.conne...@comcast.net>
wrote:
> Nolan:
> My question is due to the fact the payload for your example will not be the JSON you give. It will actually be:{'id':'app_20', 'username':'value', 'password':'value'}The "id" property will appear in the payload although there is no 'id' input in the fieldset.
> Just run the Fieldsets Example in the Appcelerator documentation and you will see this. Value is usually app_xx where xx is numeric. I have no idea if this value is meaningful or predictable. I have no idea how to suppress it.
> Maybe the 'id' property is a bug, since neither one of us expected it.
> -- Dan Connelly
> Nolan Wright wrote:I'm not sure I understand your question, but here's some info on fieldsets: they are used to link input fields together for the purpose of sending a message. When a message is generated by a member of a fieldset, we place all of the values of the fields that share the same fieldset name (e.g., fieldset="my_form"). When setting the message payload we look at the "id" value to set the name portion of the name/value pair. You should also be able to use "name" as well. Here's an example: <input type="text" name="username" fieldset="login"/> <input type="password" id="password" fieldset="login"/> <input type="button" fieldset="login" on="click then r:login.request"/In the example above the message payload would have {'username':'value', 'password':'value'}. Not sure if this answers your question. If not, can you provide me with some additional detail? Thanks. Nolan On Jan 5, 8:24 am, Dan Connelly<daniel.s.conne...@comcast.net>wrote:Am I supposed to use the value of the "id" property to distinguish among the possible fieldsets on the page? If so, it should be the fieldset name. Is there some standard use for "id"? Does the value have a meaning?

Nolan Wright

unread,
Jan 5, 2008, 12:58:41 PM1/5/08
to Appcelerator Platform SDK
Okay, I looked at the code and ran a couple of tests. If you send a
remote message, the "id" of the element that generates the message is
NOT included in the message payload. If your message is local, it is
included.

In your example, is your message local or remote?



On Jan 5, 12:30 pm, Dan Connelly <daniel.s.conne...@comcast.net>
wrote:
> Nolan:
> My question is due to the fact the payload for your example will not be the JSON you give. It will actually be:{'id':'app_20', 'username':'value', 'password':'value'}The "id" property will appear in the payload although there is no 'id' input in the fieldset.
> Just run the Fieldsets Example in the Appcelerator documentation and you will see this. Value is usually app_xx where xx is numeric. I have no idea if this value is meaningful or predictable. I have no idea how to suppress it.
> Maybe the 'id' property is a bug, since neither one of us expected it.
> -- Dan Connelly
> Nolan Wright wrote:I'm not sure I understand your question, but here's some info on fieldsets: they are used to link input fields together for the purpose of sending a message. When a message is generated by a member of a fieldset, we place all of the values of the fields that share the same fieldset name (e.g., fieldset="my_form"). When setting the message payload we look at the "id" value to set the name portion of the name/value pair. You should also be able to use "name" as well. Here's an example: <input type="text" name="username" fieldset="login"/> <input type="password" id="password" fieldset="login"/> <input type="button" fieldset="login" on="click then r:login.request"/In the example above the message payload would have {'username':'value', 'password':'value'}. Not sure if this answers your question. If not, can you provide me with some additional detail? Thanks. Nolan On Jan 5, 8:24 am, Dan Connelly<daniel.s.conne...@comcast.net>wrote:Am I supposed to use the value of the "id" property to distinguish among the possible fieldsets on the page? If so, it should be the fieldset name. Is there some standard use for "id"? Does the value have a meaning?

Dan Connelly

unread,
Jan 5, 2008, 2:25:58 PM1/5/08
to appcelerator...@googlegroups.com
My message is local.   I will use the Http widget to POST the payload to CouchDB (RESTful persistence).

It is not essential that I suppress the 'id'.   I was curious about it.   Thanks for the help.

Jeff Haynie

unread,
Jan 7, 2008, 11:19:37 AM1/7/08
to appcelerator...@googlegroups.com
For local messages only, we include 2 additional parameters which can be useful:

id (the id of the element that generated the message)
element (the element object reference)


The element parameter is new and will be part of the next release.

The id parameter will only be placed in the data payload if it isn't already there.  So, you don't have to worry about it getting clobbered.

These 2 are not automatically included in remote messages. 

Jeff
--
Jeff Haynie
http://blog.jeffhaynie.us
Reply all
Reply to author
Forward
0 new messages