Link to home
Start Free TrialLog in
Avatar of is_staff
is_staff

asked on

Change Event Action OnClick

Our seat maps are currently designed to take users to a screen where they can select a seat they want and from there, purchase a ticket. Using the same page, I added a query string that is set for users who want to view the seat maps only and not actually purchase a ticket. Here is the query string I created, you will notice the features I want to disable when they are in "ViewOnly Mode":

 Mode = Request.QueryString["Mode"];
                if (Mode == "ViewOnly")
                    SelectPerformanceBlock.Visible = false;
                    QueueBlock.Visible = false;
                    MaximumTixBlock.Visible = false;
                    LegendHeaderBlock.Visible = false;

Open in new window


I want to include a function after users selected their zone, send them to a page that shows the view from their selected seat. This "view from seat" feature is currently enabled on the page but can only be accessed if users manually click the link. The view from seat feature uses an OnClick function and is written in java-script. My question is how can I enable the "view from seat" function to automatically be displayed when users are in ViewOnly Mode?
Avatar of is_staff
is_staff

ASKER

If I'm understanding you well, you need to call a javascript function when entering a page on a determinated state, and this function, usually, fires when clicked on a link.

You can do the following:
On the page, add a listener to body's onLoad event.
On that event firing, you can check if the page is on ViewOnly mode. If this ViewOnly mode is only visible from server code, you can push this value to a hidden input object on your page when loading and read this value directly from javascript.

if the page is on ViewOnly mode then you call the function or directly fire the onClick event of the link (both actions will do the same), if the page isn't on ViewOnly mode exit onLoad listener.

On those cases where there's no ViewOnly mode, the onClick event listener still will be there, ready to enter on "view from seat" when the click event is fired.
Thank you for your response. Yes that is correct.

Is there an example you can share with me?
Initially it's something quite easy... is there anything in particular with wich you have trouble? I can try to sketch it up a bit in a code snippet...
I'd like to see how to directly fire the onClick event of the link please and thank you.
ASKER CERTIFIED SOLUTION
Avatar of Bardobrave
Bardobrave
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay. I'll give it a try and let you know how it goes. Thanks!