Showing posts with label paul. Show all posts
Showing posts with label paul. Show all posts

Wednesday, April 01, 2009

Troubles calling form.submit()

Apparently you can't have an element with an id of submit in a form and call form.submit()

It will try calling that element as a function rather than invoking the form.submit method


<form onsubmit="agree();return false;">



<div class="buttons">

<input type="submit" name="iAgree" id="iAgree" value="I Agree" class="button" />

<input type="button" name="disAgree" id="disAgree" value="Cancel" class="button" onClick="tb_remove();" />

</div>

</form>
agree is not a function
<input type="submit" name="agree" id="agree" value="I Agree" class="button" />

so if the form has an element named agree
agree is not a valid function name in the onsubmit
weird

Tuesday, December 30, 2008

Proper fix for cfgrid having empty rows and wrong information on last page

<cfset startRow = ((page-1) * pageSize) + 1 />
<cfset endRow = startRow + pageSize - 1 />
<cfset tmpQuery = queryNew(get_query.columnList) />
<cfloop query="get_query" startRow="#startRow#" endRow="#endRow#">
<cfset tmp = queryAddRow(tmpQuery) />
<cfloop list="#get_query.columnList#" index="column">
<cfset tmp = querySetCell(tmpQuery,column,evaluate("get_query.#column#")) />
</cfloop>
</cfloop>
<cfset gridQuery = structNew() />
<cfset gridQuery.query = tmpQuery />
<cfset gridQuery.totalrowcount = get_query.recordcount />
<cfreturn gridQuery />




big thanks to Paul