tags:

views:

42

answers:

1

How can i assign to one Button multiple actions:

  1. A Timestamp
  2. A href to next page
  3. Assign a numerical value depending on where you clicked.

In Django.

Onclick.

How is that possible?

in Html

in Django Views

And the timestamp needs to be recorded at the users browser (when he clicks) and NOT when it is arriving at the server.

Thanks you.

A: 

I don't really see multiple actions here. I also cannot imagine the need to get a timestamp for when a user clicks instead of when the request arrives at the server, does it really matter? If it does, you can just create the timestamp in JavaScript and set a hidden field on your form or something along those lines.

Also, use <input type="image" /> that will pass where they clicked along with submitting the form.

For the href to the next page... i'm not sure what you're even asking about here. Put a hidden field on your form with the next page value? Or just do a redirect in your Django view.

Matthew J Morrison
Thanks!. Trust me it mattters to me a lot.What i want is that if the user clicks that button.He1. Gets to the next page in a paginator like setup.2. The Timestamp is recorded and saved to db3. And I by where he clicked (Region 1, Region 2) can assign a value to this. How exactly would that hidden field work?I did not understand this sentence of yours:Also, use <input type="image" /> that will pass where they clicked along with submitting the form.Can you explain in more detail, please?
MacPython
@MacPython - try googling "input type image"
Matthew J Morrison