3 Replies Latest reply on Jun 20, 2009 2:59 PM by gkaiseril

    medical questionaire

    KennyAaaa

      I am creating a medical questionaire and would like to be able to have a button that either clears all yes/ no option buttons (set them blank) and a second one that sets them to all to no.  In additon how do i force an entry in a text box if a option button is set to Yes?

       

      TIA

        • 1. Re: medical questionaire
          telecommunicate Level 2

          How's your JavaScript?

           

          I'd probably do this (the set all fields to no button) by adding a button that uses a JavaScript for loop and a combination of this.getField() and this.getNthFieldName() (possibly checking the type property in order to modify only fields of checkbox type), and modifying the value property.

           

          You can use this.resetForm to (not surprisingly) reset the form.

           

          Similarly, you'd use a custom calculation script in the field that you want to update depending on the value of the checkbox.

           

          This is all pretty straightforward JavsaScript stuff, you might want to refer the to the JavaScript sections in the SDK.

          • 2. Re: medical questionaire
            formwrite

            Hi

             

            I do not know a way to clear the option (Radio) buttons on one button and then set them to No on another button; but I can clear them only or clear them and set them them to No on one button if that is any use.

             

            First to clear all the option buttons:

             

            1. Add a Push Button to the form.

            2. On the actions tab of the Button Properties Select Action to Reset a form and click Add

            3. On the Reset a Form Dialog just tick the fields that apply to option buttons and click OK

             

            If you want the same button to set all the Radio Buttons to No then for each No button select "Button is checked by default" on the Options tab of the Radio Button Properties. Using the Clear Push Button set up above will then return the option buttons to their default value of No.

             

            Not quite what you were wanting but maybe it will give you some ideas?

            • 3. Re: medical questionaire
              gkaiseril MVP & Adobe Community Professional

              With out using JavaScript, check boxes can be cleared by checking an already selected check box, radio buttons can not be cleared. So if you have a mandatory selection use radio buttons and provide an "N/A" option.

               

              With JavaScript, one can use the 'resetForm()' form method with the oprtional arrary of field names to reset for a large group of fields or one can set the check box or radio button field to a value of 'Off'.

               

              As to forcing the completion of a form field when an item is checked, there is no fool proof method, But one can set the text field's property to 'required'  and then create a validation scirpt to check that all required fields are completed for a 'will save' or 'will print' action and take the appropriate action as needed.