JavaScript objects can't have a method and a property of the same name. Rename one of the two.
On Sun, Dec 2, 2012 at 10:20 AM, Erez <[email protected]> wrote: > Hi. > I'm using v8 to process web pages. > I have the following problem with a code on a certain site. > The site has the following structure of forms: > <form method='POST' action='formaction.aspx'> > .... > .... > <hidden name='method' id='method' value='' /> > <hidden name='action' id='action' value='' /> > <hidden name='objectid' id='objectid' value='' /> > </form> > > The form content is a table of data, where each row contains a few actions > that can be applied to the data (edit, copy, view) and such. > The actions are implemented in JavaScript code with an onclick event to a > function similar to this: > function sumbitForm(objectid, formName, method, action){ > var form = document.forms[formName]; > form.objectid.value = objectid; > form.method.value = method; > form.action.value = action; > form.submit(); > } > > The problem is that when the code executes, calling form.method.value > really returns the accessor (getter) to the form method attribute instead > of the form method hidden parameter. > > I've defined the accessors like this: > functionTemplate->InstanceTemplate()->SetAccessor(String::New("method"), > GetMethod, SetMethod); > > The GetMethod signature is: > Handle<Value> HTMLFormElement::GetAction(Local<String> property, const > AccessorInfo& info) > > I've defined the named property accessor like this: > > functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(NamedPropertyAccessor); > > The NamedPropertyAccessor signatures is: > > Handle<Value> HTMLFormElement::NamedPropertyAccessor(Local<String> > property, const AccessorInfo& info) > > Any thoughts? > > Thanks, > Erez > > > > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
