PDA

View Full Version : [SOLVED]need a text link to popup an alert



talshadar
9 Apr 2009, 12:42 PM
Something I thought would be really simple... isn't. Basically, when a user selects a certain value from a combobox, I'm displaying some additional information. Part of that information needs to be a text link that will pop up an alert box with a bunch more information. I thought it would be simple, but I'm having no luck at all. I'm hoping someone can help.

this is the function that sets up the information



function getInterfaceInfo_Callback(response)
{
if (response.rows)
{
dsInterfaceStore.loadData(response.rows);
record = dsInterfaceStore.getAt(0); //get first record

recordName = "<a href='#' onclick='popupInterfaceInfo(); return false;'>" + record.get('Interface_No') +"</a>";;
receiptParty = record.get('Receipt_Party');
rpContact = record.get('RP_Contact');

txtInterfaceInfoPlaceholder.dom.innerHTML=recordName + "<br>" + "Receipt Party: " +receiptParty +"("+rpContact+")";

}
}
this is the function I need called


function popupInterfaceInfo()
{
var msgText = "";

msgText = recordName;
msgText += + "<br>" + "Receipt Party: " +receiptParty +"("+rpContact+")";
msgText += "<br>" + "Status: " + status;
msgText += "<br>" + "Identified Date: " + identified_date;
msgText += "<br>" + "Closure Date: " + closure_date;

Ext.Msg.alert(recordName + " Information",msgText);
}

talshadar
14 Apr 2009, 7:47 AM
My solution - probably obvious but I'll do it anyway.

In the main HTML page:



<script type="text/javascript">
function popItUp(interfaceInfo)
{
Ext.Msg.alert("Interface Information",interfaceInfo);
}
</script>


then created the string I needed - calling the javascript popup function
set the innerHTML to the string.


recordString = "<a href='#' onclick='popItUp(" +'"'+ msgText +'"'+ ")'; return false;'>" + record.get('Interface_No') +"</a>";
txtInterfaceInfoPlaceholder.dom.innerHTML=recordString + "<br>" + "Receipt Party: " +receiptParty +"("+rpContact+")"+ "<br>" + "Delivery Party :" + deliveryParty +"("+dpContact+")";


May seem straight forward and obvious but it took me a bit to figure out lol.