Link to home
Start Free TrialLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

how i get the value from form to url

Hi experts, i have one combobox which gets the value of records from database.

Suppose there are 100 records in adatabase and i retrieve the records using thee cfform post method by which it passes the value in a form field.

i tend to use the paging where i want to use to display 20 records @ at a time.

Is there any way i can automatically convert the form value to url and paging should work fine

Something below i have:

<cfform method="post" action="index.cfm?action=products">
<table width="100%" border="0" cellspacing="2" cellpadding="1">
  <tr>
     <td width="61%" align="right">View Products In:&nbsp;</td>
    <td width="14%" align="right"><select name="cboCategory" id="cboCategory" tabindex="1" class="textfield_effect">
        <option selected value="0">All Category</option>
        <cfoutput query="sme">
            <option value="#cat_id#">#cat_name#</option>
        </cfoutput>
      </select></td>
    <td width="3%" align="right"><input type="submit" name="view" id="view" value="Go" tabindex="2" class="submit" style="width:25px; height:23px;"></td>
  </tr>
</table>
</cfform>
 
now i have something like this:
 
<cfif isDefined('form.view')>
 <cfoutput query="sme" startrow="#pagination.getStartRow()#" maxrows="#pagination.getMaxRows()#">
      <tr align="left">
        <td width="376">#trim(pd_name)#</td>
        <td width="160"><cfif pd_thumbnail IS ""><em><div align="center"><strong>No Image</strong></div></em><cfelse><img src="products/thumbnails/#pd_thumbnail#"></cfif></td>
        <td width="305">#cat_name#</td>
        <td width="74"><a href="?action=products&eID=#URLEncodedFormat(pd_id)#&add2=yes">Edit</a></td>
        <td width="70"><a href="?action=products&deleteID=#URLEncodedFormat(pd_id)#" onClick="return confirm('Are you sure');">Delete</a></td>
      </tr>
    </cfoutput>
    <tr>
      <td colspan="5" align="center"><cfoutput>#pagination.getRenderedHTML()#</cfoutput></td>
    </tr>
</cfif>
 
pagination code:
 
<cfset pagination = createObject("component", "#request.cfcPath#.Pagination").init()/>
<cfset pagination.setQueryToPaginate(sme) />
<cfif IsDefined('url.action') AND url.action eq 'products'>
<cfset pagination.setBaseLink("index.cfm?action=products") />
<cfelse>
<cfset pagination.setBaseLink("index.cfm") />
</cfif>
<cfset pagination.setItemsPerPage(2) />
<cfset pagination.setUrlPageIndicator("page") />
<cfset pagination.setShowNumericLinks(true) />

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Coast Line

ASKER

Yes! You Rock