Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink doesnt respond properly

Status
Not open for further replies.

compu66

Programmer
Dec 19, 2007
71
US
Hi all,

I have a hyperlink "Save" which should through a pop up when the "setcategory" (which is another hyperlink when user click it opens a javascript window with a dropdown from which a category need to be selected) is not selected.

Now my problem is when initially I click on "save" hyperlink it doesnt thorough a popup ,but when clicked another time it throughs the pop up.

Is there any solution.

Thanks for any kind of help in advance.
 
It's probably a problem with your code and the way you are applying the js. What is the code that creates the pop up?
 

Hi all,
Thanks for your response.Here is the code which causes the javascript popup.
If (dh.RequiresMamTracking(nExam) And String.IsNullOrEmpty(lblMamCatDescription.Text)) Then

btnSave.Attributes.Add("onClick", "javascript:verifyCategorySelection();return false")


Else
' ' Set the transcribed date to today since the user is clicking 'save'
txtTransDate.Text = Now.ToShortDateString()

Update_Event("noupdate")
Me.nAccessionNumber = Me.txtAcc1.Text.Trim()

dh.LogPageAccess(Me.lblPatientID.Text.Trim(), CommonFunctions.GetCookie(Request, "ID"), Convert.ToInt32(Me.txtAcc1.Text.Trim()), DateTime.Now, "Transcibe - Save")

Get_Info(Me.nAccessionNumber)

dh = Nothing
End If
Thanks for any help in advance....
 
The below code is wriiten in Btnsave_click event which is the "save hyperlink" event.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If (dh.RequiresMamTracking(nExam) And String.IsNullOrEmpty(lblMamCatDescription.Text)) Then
btnSave.Attributes.Add("onClick", "javascript:verifyCategorySelection();return false")------------------here is the exact place from where the javascript code is getting called
Else
something xyz
end if


Here is the javascript code which gets called.
function verifyCategorySelection(){
//alert('Test Hello');
var mamCatDesc = document.getElementById("lblMamCatDescription");
//alert(mamCatDesc);
if(mamCatDesc!=null){
//alert("*" + mamCatDesc.innerHTML +"*");
//for testing later remove the following line
//mamCatDesc.innerHTML = "";

//alert("*" + mamCatDesc.innerHTML +"*");
var mamCatDescValue = mamCatDesc.innerHTML;
if(mamCatDescValue.length==0){
alert("Mammo Category Description missing...., please select the category first");
return false;
}
}

return true;
}


I hope I could provide all that code that you asked.Excuse if I couldnot get you.

Thanks for you valuable time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top