The onclick property of an HTML element must be Javascript. You cannot call
a server-side Python function directly from the browser. If you want the
button to work like a regular link and simply load a new page in place of
the current page, you can do:
<Button type="button" name ="seeting_button"
onclick = 'window.location="{{=URL('default', 'record_config',
args=[record_id])}}";'>
In that case, you would need Python code in the view to get the record_id
for each link (presumably the buttons would be generated in a for loop that
cycles through the record id's).
Anthony
On Monday, August 27, 2012 7:27:20 AM UTC-4, Amit wrote:
>
> Hi,
> I have created one html file with list of records, each records are there
> in a row of table in
>
> html and there is one corresponding button (type as button) for each
> record so when user clicks
>
> on it , it should take the id of that record from the html call controller
> function which will
>
> further use id to fetch the complete records from the database and
> rendered the data onto the new
>
> html page.
>
> below is the button creation code in html:
>
> <td style="text-align: center; vertical-align: middle;">
>
> <Button type="button" name ="seeting_button" onClick = "record_config();">
>
> <IMG src="{{=URL('static','images/Settings.png')}}" ALIGN="absmiddle">
>
> </td>
>
>
>
> here record_config() function defined in controller (default.py) which
> will fetch data from db
>
> and display to another html page named "record_config.html".
>
> Problem:
> record_config() function is not getting called upon clicking on the
> button, can anyone please
>
> suggest me the possible way to achieve the same?
>
--