JavaScript checkbox

Linoa -  
Ozimandias Posted messages 528 Status Member -
Hello,
I created a form in Adobe and I have a checkbox called "precours" that should take the value from another field called "cours" if it is checked. Then this value is taken into another field called "hebdo". How can I make it so that when you click the checkbox once, the value appears directly in the "hebdo" field?

Thank you in advance for your support!
Configuration: Mac OS X Safari 531.21.10

7 answers

  1. Ozimandias Posted messages 528 Status Member 46
     
    Which Adobe software?
    Flash, Fireworks, Acrobat Pro? The language is not the same in all these software.
    --
    Two intellectuals sitting go less far than a brute walking.
    !!! You got an answer... Remember to mark your topics as resolved!!!
    0
  2. Ozimandias Posted messages 528 Status Member 46
     
    Whoa, I'm pulling out my books... and I'll tell you this.

    --
    Two sitting intellectuals go less far than a brute who walks.
    !!! You have received an answer... Remember to mark your topics as resolved!!!
    0
    1. Linoa
       
      Great!
      0
  3. Ozimandias Posted messages 528 Status Member 46
     
    You need to:

    display the properties of your checkbox (the starting one) with right click properties.
    after giving it a unique identifier (name) you need to go to the action tab and add code there

    Here is basically what you will need in this code:

    how to find a field
    this.getField("FieldName")

    so to get the associated value of the field
    this.getField("FieldName").value


    As for if statements and other conditional structures, they work like JavaScript.

    Your code should look like this:

    if (this.getField("course").value == "checked"){ this.getField("precourse").value = "checked"; this.getField("weekly").value = "checked"; } 


    All the explanations of this language in PDF format here http://www.google.fr/...
    --
    Two intellectuals sitting go less far than a brute walking.
    !!! You have received a response ... Remember to mark your topics as resolved !!!
    0
    1. Linoa
       
      It works great! But there's a small problem: if you uncheck it, the value of "hebdo" is still visible, whereas it's the checkbox that validates it!
      0
  4. Ozimandias Posted messages 528 Status Member 46
     
    ben du coup:

    if (this.getField("cours").value == "checked"){ this.getField("precours").value = "checked"; this.getField("hebdo").value = "checked"; } else this.getField("precours").value = ""; this.getField("hebdo").value = ""; }  


    si ça ne marche pas essaye avec this.getField("precours").value = false;
    --
    Deux intellectuels assis vont moins loin qu'une brute qui marche.
    !!! Vous avez obtenu une réponse ... Pensez à marquer vos sujets comme résolus !!!
    0
    1. Linoa
       
      always the same little problem!
      0
  5. Ozimandias Posted messages 528 Status Member 46
     
    after else there's a { that I forgot.

    --
    Two intellectuals sitting go less far than a brute who walks.
    !!! You have received an answer... Remember to mark your topics as resolved !!!
    0
    1. Linoa
       
      Hello,
      Thank you so much for this working script! However, my form (Adobe ACROBAT) is finished, but when I send it to someone for filling, there’s an error message like "no access to this method due to security concerns." There’s no protection on the document, so I’m puzzled.
      Thank you in advance for your support.
      0
  6. Ozimandias Posted messages 528 Status Member 46
     
    I believe this is beyond my skills, note the exact message is better. Because "something like that" is not very precise.

    --
    Two intellectuals sitting go less far than a brute who walks.
    !!! You have received a response... Remember to mark your topics as resolved!!!
    0