• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using javasxript in forms to copy and paste selected entries into another section of that form

Community Beginner ,
Sep 01, 2020 Sep 01, 2020

Copy link to clipboard

Copied

I'm trying to create a survey that will allow people to identify movies they do or do not like.

 

I would then like people to pick, among the ones they do like, the ones they like best and among those they don't like, the ones they like the least.

 

My idea is to copy all the yes items into a section 2, part a form, and all the no answers into a section 2, part b form, so that people can then select from those specific sections.

 

Is there a relatively easy way to do this using javascript? The movies listed in section one will be selected as check boxes as opposed to radio buttons. Not sure if this matters at all, but thought worth mentioning.

 

Thank you!

TOPICS
Acrobat SDK and JavaScript

Views

342

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 01, 2020 Sep 01, 2020

Copy link to clipboard

Copied

It is relatively  easy with JavaScript if that is all this form will do.

 

And with JavaScript there are many easy ways of creating this workflow.

 

For example, if it was up to me I would employ the  use of a dropdown menu with 2 options: "like the best" and "like the least".

 

Next to the dropdown menu , I would use a read only textfield pre-filled with a movie title.

 

And based on what the user choose in the dropdown menus, I would use custom calculation script to copy the answer and tge movie title text string values to the desired part a and part b sections; no radio buttons or checkboxes necessary.

 

 

 

However, if it was up to me to choose what would I prefer for this project, definitely checkboxes  but acting like radio buttons.

 

I would set the checkboxes mutually exclusive (same name, different export values each). So, when the user selects yes or no from the dropdown menu, both the answer and the textfield with the movie title v are pushed to the  a or b part sections.

 

In comparisson toradio buttons, the checboxes allow the user to uncheck them, which is convenient if they change their mind with a given answer and decide to change it; this will not happen with a pair of radio button since one will always appear check and you'll need an additional reset button(or similar to clear them)

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

ls_rbls, that's exactly why I wanted check boxes, so the surveyors can de-select choices if they want to come back to it later. I didn't think about having the movie title in text boxes because I originally created the form in word and exported it to PDF, but now that I think about it, I can see how having them in text boxes would be helpful, so I can simply export those that are selected as like and disliked to their appropriate subsections. This is a great idea. Thank you!

 

My next question concerns the isertion and deletion of titles after they have been selected and deselected. I would like to be able to have it so that all movie titles are next to each other, and, if a title is removed, have titles that come after it move up to fill the newly empty space. I'd also like to be able to place selected titles in alphabetical order, but that's really only a cherry-on-top option, and is not high priority at all.

 

Thank you for the advice you've already given, and any other advice you have to give. I appreciate it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

Yes that is possible too but it requires a little more javascripting. 

 

If I understood correctly you want all the selected  movie titles that were selected to appear in a multi-line text field ( I assime Part A nd B sections). And also sorted out in alphabetical order.

 

The alphabetical order you can work around by using the sort() method ; by default it arrays in alphabetical order but this is a more advanced and trickier javascripting since it can trigger errors if used with numerical order and scripting. Some more advanced scripting knowledge is required.

 

Are you looking into learning JavaScript or are you currently outsourcing and in need of hiring a developer for this project?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

LATEST

Yes, what you said re: placing them on multiples lines, probably in couple of columns.

 

I am a novice programmer with some very small background in Python and Java. I have done other minor things with forms before, but nothing that required this extensive level of use of javascript.

 

I've downloaded the JS API Reference, and have been reading over it, but am unfamiliar with all of the methods still. I'm helping a friend with this project and trying to use it to become more familiar with JS in the process.

 

Your comments really help, and I appreciate the help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines