Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6
This is the forum to discuss the Wrox book Professional Ajax, 2nd Edition by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780470109496
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 26th, 2011, 09:47 AM
Registered User
 
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with function getRequestBody

function getRequestBody(oForm) {

//array to hold the params
var aParams = new Array();

//get your reference to the form
var oForm = document.forms[0];

//iterate over each element in the form
For (var i=0 ; i < oForm.elements.length; i++) {

//get reference to the field
var oField = oForm.elements[i];

//different behavior based on the type of field
switch (oField.type) {
case "text":
case "hidden":
case "password":
aParams.push(encodeNameAndValue(oField.name, oField.value));
break;
}
etc..

Well the offending line is as follows

aParams.push(encodeNameAndValue(oField.name, oField.value))

do not recognize the oField.name...
to return the call the string does not contain the names of parameters, but only the values for example

=daniel&=moon

missing name: user=daniele&psw=moon

Thanks
Reply With Quote
  #2 (permalink)  
Old February 26th, 2011, 12:12 PM
jmcpeak's Avatar
Wrox Author
Points: 467, Level: 7
Points: 467, Level: 7 Points: 467, Level: 7 Points: 467, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 87
Thanks: 0
Thanked 17 Times in 16 Posts
Default

Can you provide your markup, please?
Reply With Quote
  #3 (permalink)  
Old February 26th, 2011, 01:49 PM
Registered User
 
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Smile I solved

I solved .. I had not declared a "name" tag in the input using only "id". I modified the function this way:

if (oField.name!='')
aParams.push(encodeNameAndValue(oField.name, oField.value));
else
aParams.push(encodeNameAndValue(oField.id, oField.value));
endif

many thanks
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem function lejka Java Basics 1 August 20th, 2009 03:53 AM
function problem lejka Java Basics 0 August 7th, 2009 03:31 AM
getRequestBody function vs checkbox Passero BOOK: Professional Ajax ISBN: 978-0-471-77778-6 2 May 29th, 2006 12:21 PM
Problem with function mat41 Classic ASP Basics 3 July 16th, 2005 02:19 AM
Problem with a Javascript function SuMajestad PHP How-To 4 August 17th, 2004 10:04 PM



All times are GMT -4. The time now is 08:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.