edit: cant change heading. must be “value”
hi there,
I go mad.
In one form I have a pretty complicated sheme of showing, hiding and updating values for some fields. background is this: some of our customers have one single person as contact person, other have two.
so I build a form like this:
- one select field: {Anrede}
(German for adress, to adress somebody)
“Herr”, “Frau”, Familie", “Frau und Herr”, “Frau und Frau”, “Herr und Herr” and “unbekannt”
(english: Mr, Mrs, Family, Mrs and Mr… till "unknown)
-
I build a Label field (" {begr} ") which is empty in the beginning. It contains later the full salutation as a preview (“Dear Mr. Potter,”)
-
I build three Text-Fields: Name, Name 1 and Name2 which arent shown in the beginning.
What it should do:
When I select “Mr”, “Mrs” or “Familie” the field {name} must be shown, name1 and name2 must be hidden
(note that its totaly correct in germany to say "Dear family Potter)
When I selct “unknown” all name-fields must be hidden
When I select “Mr and Mrs”, “Mrs and Mrs” or “Mr and Mr”
Name1 and Name2 must be shown, name 1 must be hidde.
I use onclick for trigger ajax on {Anrede}-Select. It works.
the following is complicated.
- name on change:
when name changes value, {begr} - label - field must be “Dear {Anrede} {Name}”
(concret in german its more complecated, because you say “Sehr geehrter Herr…” for man and “Sehr geehrte Frau …” for woman, but ok)
-
when name=="" (changes to be deleted)
begr must be “Sehr geehrte Damen und Herren” (Dear Ladies and Gentleman) without Names AND selct-field {Anrede} must be changed to “unknown”. Also Name, Name1 and Name2 must be hidden. -
entering something in name1, than name2 must appear.
-
when name2 appears and something is written in, {begr} must be “Dear Mr. Poter, Dear Mr James” or st like that
and so on. when name2 is deleted, name1 and name2 must be unshown, select must be “Mister” and field name must appear.
So.
Showing and hiding field work pretty well.
but when it comes to update the {begr} Label SC strikes. Some update are done, some are just ignored.
For example: When the fiel {name} something, p.e. “Potter”, the {begr} - Field is correct with “Dear mister Potter” (or Mrs when Mrs is selcted)
But than: I clear the {name} field.
the new {begr} must be “Dear Ladies and Gentleman” and the new selct must be “unknown”.
But it doesnt update. And this is funny, because I just entered a showing-message-marcro right before the update-command. So I know the parser is in the correct place in the ajax-event “on change name”:
if ({name}==")
{
sc_field_display({name}, 'off');
sc_field_display({name1}, 'off');
sc_field_display({name2}, 'off');
{Anrede}="unbk";
sc_ajax_message("Here we are", "Testmessage");
{begr}="Sehr geehrte Damen und Herren";
}
The fields are hidden completly correct. the message is shown. but the begr-label-field has still “Dear Mr Potter”.
this happens a lot when i play around with the field.
can the content of a label-field not be changed more than - lets say - 5 times inside a ajax-event? is “name” something i cant use as fieldname, because it hast other, sc-meanings?
I go mad. I am pretty sure that my “If—” lines in all these ajax-event are right, because the showing and hiding-field - stuff works. and mostly the begr-update works, too. but at some point of the script, p.e. when i delete a name, the begr-updates a just ignored.
someone experience with that behavior of SC?