Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Small bit of javascript help please

  • 03-07-2008 5:18pm
    #1
    Closed Accounts Posts: 12,382 ✭✭✭✭


    Hello

    I would really appreciate some help on this.

    The website is www.tempjobs.ie

    1. The user selects the location "Cork", enters her details and then submits her application.
    2. On the confirmation page, she notices she made a mistake so she hits the back button.

    Problem: the location "Cork" will be correctly selected, however the agency list will be for Dublin.

    Does anyone know how I can force the agency list to update to the correct location, i.e. Cork?

    Note the agency list updates based on which location is selected, and it uses a simple javascript "if location==whatever" to figure out which agencies to display.

    For some reason when the back button is pressed, it always thinks the location is Dublin. I think this is because the location only changes if the "onchange" method is called. If course, there is no "onchange", I just want it to remember what it was set to a minute ago.

    Can this be done?

    Any help appreciated.

    Thanks!


Comments

  • Registered Users, Registered Users 2 Posts: 4,287 ✭✭✭NotMe


    You have <body onload="agency('Dublin');">
    so when the page loads it sets the agency list to the Dublin one.

    You wanna do something like <body onload="agency();">
    and change the agency() function to
    function agency(){
       var location = document.getElementById("location").value;
       if(location == "Dublin") {
       ....
    
    }
    
    

    and the select box to:
    <select id="location" onchange="agency();">
    


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    That worked perfectly. Thank you for taking them time to help me.


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Actually, I just noticed your javascript change is causing the agencies list to _not_ display in Firefox.

    Do you have any idea why this is?


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    dublindude wrote: »
    Actually, I just noticed your javascript change is causing the agencies list to _not_ display in Firefox.

    Do you have any idea why this is?

    Could be a few reasons for that:

    You are using document.getElementById(), but the form field doesn't have an ID just a NAME.

    Also, the function still takes a location input parameter, but the onload event doesn't send one in.


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Hi Eoin

    Thanks for your message, you pointed me in the right direction. Adding id="location" to the <select> sorted it out.

    Cheers.


  • Advertisement
Advertisement