No announcement yet.

OnChange trigger hide/show and vuelue updates: bug or am i too stupid?

  • Filter
  • Time
  • Show
Clear All
new posts

  • OnChange trigger hide/show and vuelue updates: bug or am i too stupid?

    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:

    1. 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)

    2. I build a Label field (" {begr} ") which is empty in the beginning. It contains later the full salutation as a preview ("Dear Mr. Potter,")

    3. 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.

    1. 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)

    2. 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.

    3. entering something in name1, than name2 must appear.

    4. 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.


    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');
        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?
    Last edited by nina_sorensen; 11-08-2013, 11:52 AM.

  • #2
    ** deleted post **
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /