Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-27-2013, 08:46 PM   PM User | #1
Shevarash
New to the CF scene

 
Join Date: Feb 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Shevarash is an unknown quantity at this point
Post How do I get a pdf text box to populate a numerical value based on a droplist choice?

Ok, I have everything I need on this pdf except this darn drop list, which 4 aspects of the sheet depend upon...Here's the situation:

(All titles are ALL CAPS and no quotes, just quoted for ease of reading)

I have a drop list "SIZE" and the options are "SMALL", "MEDIUM", and "LARGE".
I have a text box "SIZE_MOD" and I need it to display "-1" when "SMALL" is chosen in the "SIZE" droplist; "0" when "MEDIUM" is chosen; and "+1" when "LARGE" is chosen.

First, is this even possible?

Second, do I do this using the export field in the dropbox preferences? Or do I do this in the Calculation field in the Text form preferences?

Also, I am not sure if I am allowed to do this or not, but I am going to attempt to provide a link to my Dropbox page with the form on it, in case I didn't describe it correctly to anyone. And feel free to ask me to upload something else or give more details if necessary. Anything to get this darn thing solved! lol.

-Shev

Edit: forgot link, here it is:

https://www.dropbox.com/s/gnzwhl0idc...acterSheet.pdf

Last edited by Shevarash; 02-27-2013 at 08:46 PM.. Reason: forgot link
Shevarash is offline   Reply With Quote
Old 02-27-2013, 08:59 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Well, of course it is possible. Is this what you are wanting?

Code:
<select id = "SIZE" onchange = "go()">
<option value = "">Choose ...</option>
<option value = "-1" >SMALL</option>
<option value = "0" >MEDIUM</option>
<option value = "+1" >LARGE</option>
</select>
<input type = "text" id = "SIZE_MOD" size =  "2" readonly>


<script type = "text/javascript">

function go() {
var val = document.getElementById("SIZE").value;
document.getElementById("SIZE_MOD").value = val;
}

</script>

These once-in-a-lifetime events seem to be happening on a regular basis. - Presenter BBC News Channel
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 02-27-2013, 09:46 PM   PM User | #3
Shevarash
New to the CF scene

 
Join Date: Feb 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Shevarash is an unknown quantity at this point
@ Philip M

That looks theoretically great! lol. But will the scripting code (the less than greater than brackets) work in adobe? I need this to work on that sheet, but all the code I've seen so far, and used, is the {} brackets. I'll try it out anyway in the meantime and see if it does anything. Thank you so much for replying so quickly!

-Shev

Edit: Also, would this go in the Drop List export value field, or in the text box calculation field in their respective preferences?

Last edited by Shevarash; 02-27-2013 at 09:48 PM.. Reason: Elaboration
Shevarash is offline   Reply With Quote
Old 02-27-2013, 09:51 PM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,455
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
the posted code looks like it was meant for a browser, not a PDF viewer...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Users who have thanked rnd me for this post:
Shevarash (02-28-2013)
Old 02-27-2013, 10:19 PM   PM User | #5
Shevarash
New to the CF scene

 
Join Date: Feb 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Shevarash is an unknown quantity at this point
Quote:
Originally Posted by rnd me View Post
the posted code looks like it was meant for a browser, not a PDF viewer...
Anyone know code that will work in an adobe PDF? Would love to figure this out...Have been working on this for the past week, and can't find anything this specific online anywhere, or in any of my books.
Shevarash is offline   Reply With Quote
Old 02-28-2013, 07:57 AM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Sory, I don't know anything about Adobe PDF. Is there not a forum for that somewhere?

Try http://forums.adobe.com/community/acrobat
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
Shevarash (02-28-2013)
Old 02-28-2013, 05:13 PM   PM User | #7
Shevarash
New to the CF scene

 
Join Date: Feb 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Shevarash is an unknown quantity at this point
This is resolved, how do I mark it as such?

I figured out that all you have to do is fill out the Export field in the drop list box for each item as you add it to the list, and then have the text box fetch the value! So simple, I feel silly. Thank you guys for the help!
Shevarash is offline   Reply With Quote
Reply

Bookmarks

Tags
acrobat, adobe, autofill, drop lists, javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:58 AM.


Advertisement
Log in to turn off these ads.