I think my issue is that taskCode is being returned as a "None".
This is my objective. I want a form with two buttons on it. When a
user clicks one button, I want to store a row in BigTable that shows
that "Task01" started at at the current date/time. When he clicks the
second button, I want to update the completed time in that same row
with the current date/time.
Right now, I'm just working on the first button. My idea was to set
the value of the which button they clicked in a hidden field.
Text1={{ form.text1 }}
<form action="{%url views.provision %}" method="post">
<input type="hidden" name="buttonFlag"
value="StartSetupGoogleAccount">
<input type="hidden" name="taskCode" value="Task01">
<input type="submit" value="Start Setup Google Account"></td></tr>
</form>
I've alternatively tried defining my form like this:
<form action="{%url views.provision %}" method="post">
<input type="hidden" name="buttonFlag"
value="StartSetupGoogleAccount">
<!--<input type="hidden" name="taskCode"
value="SetupGoogleAccount">-->
{{ form.taskCode }}
<input type="submit" value="Start Setup Google Account"></td></tr>
</form>
but with this second method, the field is not hidden, it shows up in a
text box in front of the button.
Since I needed some way to debug and see the values, I wrote this code
in my views.py:
text1 = "debug_info:"
for key in TaskLog1.__dict__:
try:
if TaskLog1.__dict__[key] != None:
text1 = text1 + "\n" + key + "=" + TaskLog1.__dict__[key]
else:
text1 = text1 + "\n" + key + "=None"
except: #avoid errors when we hit an object such
as "User"
pass;
form2 = ProvisionForm(initial={'text1': text1});
return respond(request, user, 'provision', {'form': form2,
'TaskLog': TaskLog, 'text1': text1})
This allows me to pass "text1" back to the form to see what the value
are, and taskCode is always = None.
Any ideas how to get the value of which button was clicked? I might
eventually have 100 such buttons, each with a different taskCode value
assigned.
I've also tried setting the taskcode this way:
form = ProvisionForm(initial={'taskCode': "mytest"})
Also, is there a smarter way to debug than what I did above?
Thanks,
Neal Walters
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---