...

View Full Version : image textbox



kaiiserni
05-06-2008, 04:37 PM
Hi all,

I don't have much knowledge of javascript.
For work I have to find a solution to this problem:

At a certain Survey website we can add some modules in html or javascript code.
A problem is that we can't access or edit the <heading> section nor changing any other module preinstalled on that site.
There is a textbox where our clients can enter a URL to their uploaded picture.

Now we want to make a module on that same page that views the picture entered in that html textbox.

Java script works. (hello world script)

After a lot of googling and trying I only have this:

the textbox: <form name = "SurveyForm" ><input type="text" name="Q[871]" size="50" ></form>

the script code I have so far (remember I am not able to edit the page's heading):
<script LANGUAGE="JavaScript">
var url = "document.SurveyForm.Q[871].value";
</script>

But document.write(url); doesn't give me anything so I assume he won't certainly get a picture out of it.

Can somebody please help me out?

Thanks!

Stooshie
05-06-2008, 05:34 PM
Just a few ideas off the top of my head:

Try using a different name for the variable "url". E.g. "myURL". (I think "url" may be a reserved word.)

Also, just a thought, is the form definitely on the same page, or is it in an iframe? (if this is the case then you may need to change the reference to the form).

Is the textbox definitely a textbox and not a field that allows the user to browse their local machine and upload a document? (if this is the case then you cannot access that value for security)

Do you have the link to a test site that we can look at?

kaiiserni
05-07-2008, 01:43 PM
Just a few ideas off the top of my head:

Try using a different name for the variable "url". E.g. "myURL". (I think "url" may be a reserved word.)

Also, just a thought, is the form definitely on the same page, or is it in an iframe? (if this is the case then you may need to change the reference to the form).

Is the textbox definitely a textbox and not a field that allows the user to browse their local machine and upload a document? (if this is the case then you cannot access that value for security)

Do you have the link to a test site that we can look at?

I am one step closer. My code was correct. If I copied the whole page and renamed the textbox name to some name without "[" and "]" it worked!
But because I can't change the textboxes name in the real system, I don't know what to do.

the textbox name I have to call is Q[871].

Anyone any suggestions?

thanks a lot!

rnd me
05-08-2008, 12:56 AM
change
var url = "document.SurveyForm.Q[871].value";

to
var url = "document.SurveyForm['Q[871]'].value";

Stooshie
05-08-2008, 11:20 AM
Nice one rnd me I was scratching my head for ages trying to get the syntax to help kaiiserni.

kaiiserni
05-08-2008, 11:41 AM
change
var url = "document.SurveyForm.Q[871].value";

to
var url = "document.SurveyForm['Q[871]'].value";

Hi,

thank you all so much,

that did help!!!

thanks!!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum