Solved

the pagesize argument passed to the myposts function is not of type Coldfusion Ajax

Posted on 2008-10-30
5
309 Views
Last Modified: 2014-05-22
Hai experts

I'm getting this error

the pagesize argument passed to the myposts function is not of type
numeric

following my code

--employer.cfc--

<cffunction name="myposts"
 hint="My Posts" returntype="any" access="remote">
 <cfargument name="mysession" type="string" required="yes">
 <cfargument name="page" type="numeric" required="yes" default="1">
 <cfargument name="pageSize" type="numeric" required="yes" default="40">
 <cfargument name="gridsortcolumn" type="string" required="no" default="">
 <cfargument name="gridsortdirection" type="string" required="no" default="">
 <cfset var myposts="">


 <cfquery name="myposts" datasource="nizar">
select a.job_id,a.job_name,b.job_category_name,c.country_name,
a.job_role,a.job_requirements
from job_posts a,job_category b,countries c
where a.JOB_CATEGORY_ID=b.JOB_CATEGORY_ID
and a.COUNTRY_ID=c.COUNTRY_ID
and a.user_id='#arguments.mysession#'
order by created_date desc
 </cfquery>
 
<cfreturn QueryConvertForGrid(myposts,arguments.page,arguments.pageSize)>
 
 </cffunction>
 
--employer_posts.cfm--

<cfinvoke
 component="Employers.employer"
 method="myposts"
 returnvariable="myposts">
      <cfinvokeargument name="mysession" value="#session.user_id#"/>
</cfinvoke>

  <cfform>
  <cfgrid name="getlist" format="html" bind="cfc:Employers.employer.myposts({cfgridpage}, {cfgridpagesize}, {cfgridsortcolumn}, {cfgridsortdirection})">
  <cfgridcolumn name="job_id" header="Job ID" width="100"/>
  <cfgridcolumn name="Job_name" header="Job Name" width="100"/>
  <cfgridcolumn name="job_category_name" header="Job Category" width="100"/>
  <cfgridcolumn name="country_name" header="Country" width="100"/>


  </cfgrid>
  </cfform>
       
       


0
Comment
Question by:faizershez
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
azadisaryev earned 500 total points
ID: 22840018
your myposts function requires 3 arguments: mySession, page & pageSize (they are set with required="yes" attribute, so you MUST pass these arguments to the function). but in your <cfinvoke> you are passing only ONE argument to it.

DEFAULT attribute of <cfargument> tag has no effect when an argument is set as required

but the bigger question is: why do you need that <cfinvoke> there at all???
0
 
LVL 1

Expert Comment

by:coderWil
ID: 22843098
Your CFINVOKE is passing a the pagesort value to the pagesize value.

since 3 of your function arguments are required, you need to pass them 'in the order they are declared' to the function.

Hope this helps.
0
 
LVL 27

Assisted Solution

by:azadisaryev
azadisaryev earned 500 total points
ID: 22843170
change your cfgrid's bind attribute to:

bind="cfc:Employers.employer.myposts(session.user_id, {cfgridpage}, {cfgridpagesize}, {cfgridsortcolumn}, {cfgridsortdirection})"

and get rid of your <cfinvoke>
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now