48 users online (0 members and 48 guests)  


  Results 1 to 4 of 4

Related

  1. Form Data to XML    Forum: Javascript Forum
    Replies: 0
  2. html form data output    Forum: HTML Forum
    Replies: 1
  3. form data submission    Forum: HTML Forum
    Replies: 2
  4. web form data import to ms access db    Forum: PHP Forum
    Replies: 2
  1. #1
    beosboxboy's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2002
    Location
    USA
    Posts
    2

    Want to have data in form appear elsewhere in same form

    I am doing a secure order form -- attachment -- the page has 3 text fields where a person's name would be entered. Standard Text Entry form part. I am looking for a method to make the form easier to end users so that if the name is entered in the first field (e.g., PersonName1a) then it automatically is entered by a VB or JavaScript or Bean in the two related fields where the name would be otherwise manually entered (e.g., PersonName1b and PersonName1c).

    The problem arises from the need to have data that would be formated well in a spreadsheet but due to the ratios of a monitor must be set in 3 rows.

    e.g.: NAME-*-*-*-*-*-*-*-*-*-*-*-*-*

    becomes

    NAME-*-*-*-*
    NAME-*-*-*-*
    NAME-*-*-*-*

    Any leads on a best way to do this or a better way to formulate the form would be greatly appreciated:
    SEE the form at https://secure.e-access.com/magicmakers/rental.html
    Attached Files Attached Files

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hello there.

    Javascript is the way to go if you are working within a single page.

    Javascript is very 'event' orientated. So if we make a function that checks what the contents of one form field is when you have finished with it (in other words, when focus moves away from the form element, or onBlur) then we can populate other stuff.

    Heres an example form -

    Code:
    <form name="test">
    <input type="text" name="firstName" onBlur="populate(this)">
    <input type="text" name="getsPopulated">
    </form>
    Notice 'onBlur'. This means that when the browser focus moves away from element, do the function called populate. populate() looks like this -


    Code:
    <script language="JavaScript">
    function populate(obj) {
    test.getsPopulated.value=obj.value;
    }
    </script>
    So, when focus moves away from the ext element called firstName, make sure that the value of the form element called 'getsPopulated' is the same.

    It may sem complicated, but it is quite straight forward when you get used to it. Have a play, see what you come up with.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    beosboxboy's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2002
    Location
    USA
    Posts
    2

    Talking

    Most excellent advice QuietDean. The modified form with JavaScript works well on my current system, but before I post this to the web are there any popular browsers that do not support JavaScript of which I should be aware?

    I am trying to keep in mind our non-mainstream friends on alternate platforms, not that there are many these days that use browsers like LYNX or NetPositive. I am aware that there is a growing number of sight-challenged users on-line, and have little knowledge of the reader software that is current. W3C has a very slender amount of information on these, more is most definitely needed

    Thanks greatly for the tip on the JavaScript.

    James a.k.a. BeOS Box Boy

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Glad you got it working.

    It should be okay, any browser thdoesn't support javascript should ignore the <script> tags.

    If not , make your tags like this -

    Code:
    <script language="JavaScript">
    <!--
    Your code...
    //-->
    </script>
    That should pretty much guarantee it.

    Of course, if you design functionality that means you cannot use your form with a lynx browser, then its got bad accessibility. 'Nice' options are good, but its bad to exlude your audience.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread