1

This is probably a simple jQuery/js question but I'm a novice at this and could use some help.

function launchResultViewer(){
    var elen =$MP.data.REG_AS_RS.ASSIGNEE.length;

    for (i = 0 ; i < elen ; i++)
        {var dEventid = $MP.data.REG_AS_RS.ASSIGNEE[i].EVENT_ID;

        var objPVViewerMPage = window.external.DiscernObjectFactory("PVVIEWERMPAGE"); objPVViewerMPage.CreateProcViewer(patientId);
        objPVViewerMPage.AppendProcEvent(dEventid);
        objPVViewerMPage.LaunchProcViewer(); } }

function OnClickForm(){

    var xlen =$MP.data.REG_AS_RS.ASSIGNEE.length;

    for (i = 0 ; i < xlen ; i++){
        var dOrderid = $MP.data.REG_AS_RS.ASSIGNEE[i].ORDER_ID;
        <a href='#'title ="+dOrderid+" onclick='javascript:launchResultViewer(\"" + dOrderid + "\");'>Order</a>"

        $('#clickme').click(function(){ ,} }

Say there is two elements in "i" every time I click on the link two screens open up. Each link should only open up once, what am I missing in click function?

Any help would be great.

0

1 Answer 1

1

your first problem is writing your js inline. get rif of the onclick anchor, thats what the #click me event listener is for. in the click me function put what ever action you want it to do there, and get rid of all other anchors, your code is not totally full because you have an empty function at the bottom, but I can almost bet you are calling the same function twice.

change

Order

to order

( your going to have to css it to make it have anchor behavior)

<script>
$('#clickme').click(function(){
     launchResultViewer(\"" + dOrderid + "\");
});
</script>
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for the response... If i use your function as described i get an error invalid character. So, your saying to get rid of <a href ='#' ....</a> well if thats the case, I'm not sure i know how to recreate that through css. I don't believe im calling the function twice.
yes sorry you have to add your variable which is the order id for it to work inside the click me .click function or you will get an error. also as i read it is that you are doing the function in the anchor tags and then you want to do the same thing in the "clickme" function which would call the function twice. also, in css the div or span that yout want to put "order" in: color:blue; text-decoration:underline; cursor:pointer; and that will give it the "anchor" feel
This still behaves wrong. Every time i open one link and there could be multiple orderid's i get two alerts. I need to figure out to differentiate the orderid's for each link. I believe that's where my issue lies. Also it doesn't like when i add my orderid in my function - var dOrderid = $MP.data.REG_AS_RS.ASSIGNEE[i].ORDER_ID; i get an error. But i think we are close to figuring out why this isn't working.
do you have a working site or an example because if i can see it in action I would have a much easier time in helping you debug your problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.