CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Help needed with input script. (http://www.codingforums.com/showthread.php?t=286225)

bago 01-22-2013 03:18 AM

Help needed with input script.
 
Hi,

I am not a Javascript person at all, but I found a script that does everything I need which is to take a URL get variable and put it into a form input field. The only problem is that the input field name that I need to get the variable posted too has periods in the input name (entry.24.single), and I cant simply change the name on the input field as I am using this in a custom google form input page.

So here is the line of code that is creating the problem. The InputName needs to be changed to entry.24.single, and I haven't been able to figure out how to do that.

document.forms.MyForm.InputName.value = GETDATA["foo"];

Your assistance is greatly appreciated!

Logic Ali 01-22-2013 05:25 AM

Leaving aside the fact that the form should not have a name but rather an ID:

document.forms.MyForm[ "entry.24.single" ].value = GETDATA["foo"];

When you change to an ID:

document.getElementById( "MyFormID" )[ "entry.24.single" ].value = GETDATA["foo"];


All times are GMT +1. The time now is 01:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.