Hi,
after the solution of "Validation forms 'CUT' buttons values" I'm trying to
validate the button 'Delete'.
The condition to verify is that there are not objects connected with the
entity to delete.
So I define a validator (simplified code):
"""
class canDeleteButton(FancyValidator):
def _to_python(self, value, state):
if "verify existence of connected objects":
legami = 1
else:
legami = 0
if legami:
raise formencode.Invalid(u"EMPTY THE OBJECT TO DELETE!", value,
state)
return value
"""
then I define the button like:
"""
submit1 = tw2.forms.SubmitButton(key='action1', value='Save',
name='action1')
submit2 = tw2.forms.SubmitButton(key='action2', value='Delete',
name='action2', validator=canDeleteButton)
"""
The validation proces work very well.The action is blocked and I see the
error message when ther are objects related with the entity to delete but I
can delete the 'free' from relations.
BUT:
1) if key = 'action' and name = 'action' for both the buttons then after
the validation both the buttons show 'Delete' 'value'
2) if (like in the code before) I define different key and name values for
the buttons the 'value' of the 'Save' button' is chaged in 'Invia
Richiesta' and if I look in the html source I see the 'Save' button have
not more the 'value' attribute.
At the end the question:
How can I change my code to have the 'value' of the Save' button do'nt
change
Tahnks for any help.
Best regards
Enrico
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.