Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: image textbox

  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    image textbox

    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!

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    379
    Thanks
    9
    Thanked 39 Times in 39 Posts
    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?
    Regards, Stooshie
    O

  • #3
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Stooshie View Post
    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!

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,401
    Thanks
    11
    Thanked 595 Times in 575 Posts
    change
    var url = "document.SurveyForm.Q[871].value";

    to
    var url = "document.SurveyForm['Q[871]'].value";
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • Users who have thanked rnd me for this post:

    Stooshie (05-08-2008)

  • #5
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    379
    Thanks
    9
    Thanked 39 Times in 39 Posts
    Nice one rnd me I was scratching my head for ages trying to get the syntax to help kaiiserni.
    Regards, Stooshie
    O

  • #6
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rnd me View Post
    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!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •