> it not trivial but the spec has this requirement

No, I meant:  Surely creating the xml from a Hash object is a trivial
exercise?  I mean, off the top of my head:

var propName;
var hash;
var xml;
var formid;

formid = "(whatever your form ID is)";
xml = "<" + formid + ">";
hash = $(formid).serialize(true);
for (propName in hash)
{
    if (typeof hash[propName] != "function")
    {
        xml += "<" + propName + ">" + hash[propName] + "</" + propName
+ ">";
    }
}
xml += "</" + formid + ">";

That's not tested code, and you'll need to do XML escapes on the
values where I've just used the raw value (Prototype's
String#escapeHTML may help there), but my point/question was, I'm not
seeing what the complication is?
--
T.J. Crowder
tj / crowder software / com

On May 28, 2:11 pm, "Trinath Somanchi" <[EMAIL PROTECTED]>
wrote:
> it not trivial but the spec has this requirement
>
>
>
> On Wed, May 28, 2008 at 5:01 PM, T.J. Crowder <[EMAIL PROTECTED]> wrote:
>
> > > How to convert the serialized form data to ans xml format ...
>
> > Don't take this the wrong way, but once you have the Hash object from
> > Form.serialize(true), isn't this trivial?
> > --
> > T.J. Crowder
> > tj / crowder software / com
>
> > On May 27, 3:27 pm, "Trinath Somanchi" <[EMAIL PROTECTED]>
> > wrote:
> > > the is the form
>
> > > <form id="form_id">
> > > <input type=text id=name name=name />
> > > <input type=text   id=address name=address />
> > >  </form>
>
> > > On Tue, May 27, 2008 at 6:36 PM, kangax <[EMAIL PROTECTED]> wrote:
>
> > > > Where xml node names/attributes are mapped to what?
>
> > > > - kangax
>
> > > > On May 27, 7:28 am, "Trinath Somanchi" <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > Hi ,
>
> > > > > thank you for the reply ..
>
> > > > > How to convert the serialized form data to ans xml format ...
>
> > > > > some thing like
>
> > > > > <form_id>
> > > > > <name>data</name>
> > > > > <address>adasds</address>
> > > > > </form_id>
>
> > > > > I want to know using prototype how I can do this ..
>
> > > > > please suggest me the ways to this approach.
>
> > > > > On Mon, May 26, 2008 at 4:22 PM, T.J. Crowder <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > > Hi,
>
> > > > > > I haven't needed to do it, but looking at the docs, at first glance
> > > > > > I'm thinking:
>
> > > > > > var jsonString = $('formId').serialize(true).toJSON();
>
> > > > > > Details:
> > > > > >http://www.prototypejs.org/api/form/serialize
> > > > > >http://www.prototypejs.org/api/hash/tojson
>
> > > > > > Hope this helps,
> > > > > > --
> > > > > > T.J. Crowder
> > > > > > tj / crowder software / com
>
> > > > > > On May 26, 11:32 am, Trinath Somanchi <[EMAIL PROTECTED]>
> > > > > > wrote:
> > > > > > > Hi All ,
>
> > > > > > > How to convert Serialized form data to JSON formt using
> > prototype.js
> > > > > > > framework ...
>
> > > > > > > Please help me in this regards,
>
> > > > > > > Thanks in advance ,
>
> > > > > > > --
> > > > > > > Trinath S
>
> > > > > --
> > > > > Regards,
> > > > > ----------------------------------------------
> > > > > Trinath Somanchi,
>
> > > --
> > > Regards,
> > > ----------------------------------------------
> > > Trinath Somanchi,
>
> --
> Regards,
> ----------------------------------------------
> Trinath Somanchi,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to