www.webdeveloper.com
Results 1 to 3 of 3

Thread: Pre Populate a web form

  1. #1
    Join Date
    Nov 2013
    Posts
    2

    Pre Populate a web form

    Hello,

    I am developing an app which shows alternative modes of transport to get from A to B.
    I wanted to be able to show the nearest bus route, is it possible to pre-poulate a webform when you open it. e.g. with the date/time/destination.

    http://jplanner.travelinenortheast.info/

    This is the form i am trying to populate, any help would be greatly appreciated.

    thanks

    iso

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,377

    Talking

    Don't know if this will work for you, but you could try this addition just before the end </body> tag ...
    Code:
    window.onload = function() {
      document.getElementById('fromplace').value = 'Start of destination';
      document.getElementById('toplace').value = 'End of destination';
    
    // following line may need further modifications
    // document.getElementById("dropdownlist").options[2].value //accesses value attribute of 2nd option
    // document.getElementById("dropdownlist").options[2].text //accesses text of 2nd option
    // remember to remove the default 'selected' setting for the current displayed option
    // Untested
    }
    Happy T.Day!

  3. #3
    Join Date
    Nov 2013
    Posts
    2
    Quote Originally Posted by JMRKER View Post
    Don't know if this will work for you, but you could try this addition just before the end </body> tag ...
    Code:
    window.onload = function() {
      document.getElementById('fromplace').value = 'Start of destination';
      document.getElementById('toplace').value = 'End of destination';
    
    // following line may need further modifications
    // document.getElementById("dropdownlist").options[2].value //accesses value attribute of 2nd option
    // document.getElementById("dropdownlist").options[2].text //accesses text of 2nd option
    // remember to remove the default 'selected' setting for the current displayed option
    // Untested
    }
    Happy T.Day!

    Hello, thanks for your rerply, i have it working now, its probably not a javascript issue.
    Anyway it was just a matter of adding the form and component names at the end of the url

    thanks

    iso

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles