What is wrong with my JScript Syntax

C

Craig G

the problem is caused by the cboRefSrc.SelectedValue but im unsure how to
get the selected value from the combo to put in the string

function OpenReferrer(idname, postBack)
{
var strReturn;
var myArray; strReturn=window.showModalDialog('frmReferrer.aspx?REFSRC='
+ document.getElementById('cboRefSrc').SelectedValue,
null,'status:no;dialogWidth:550px;dialogHeight:350px;dialogHide:true;help:no
;scroll:no');

if (strReturn != null)
{
myArray = strReturn.Split("$");
document.getElementById('txtReferrer_Name').value=myArray[0];
document.getElementById('txtReferrer_TelNo').value=myArray[1];
}
}
 
Y

Yunus Emre ALPÖZEN

Try document.getElementById('cboRefSrc').value not
document.getElementById('cboRefSrc').SelectedValue
 
C

Craig G

no that doesnt work either

the error i get for both is :-

Error: Unterminated String Constant
Code: 0
URL: http://localhost/CRMSWeb/frmReferrer.aspx?REFSRC=undefined


Yunus Emre ALPÖZEN said:
Try document.getElementById('cboRefSrc').value not
document.getElementById('cboRefSrc').SelectedValue
--
Thanks,
Yunus Emre ALPÖZEN



Craig G said:
the problem is caused by the cboRefSrc.SelectedValue but im unsure how to
get the selected value from the combo to put in the string

function OpenReferrer(idname, postBack)
{
var strReturn;
var myArray;
strReturn=window.showModalDialog('frmReferrer.aspx?REFSRC='
+ document.getElementById('cboRefSrc').SelectedValue,
null,'status:no;dialogWidth:550px;dialogHeight:350px;dialogHide:true;help:no
;scroll:no');

if (strReturn != null)
{
myArray = strReturn.Split("$");
document.getElementById('txtReferrer_Name').value=myArray[0];
document.getElementById('txtReferrer_TelNo').value=myArray[1];
}
}
 
W

William F. Robertson, Jr.

try debugging with this:

alert( document.getElementById('cboRefSrc').id );
make sure that is says: cboRefSrc

if that doesn't work then try

control = document.getElementByID( "cboRefSrc" );
if ( typeof( control ) == "undefined' )
alert( "Could not find control named cboRefSrc in the document." );

also try putting "debugger;" at the beginning of the OpenReferrer message.
Then you can step through your javascript code.

..value is in lowercase right?

HTH,

bill


Craig G said:
no that doesnt work either

the error i get for both is :-

Error: Unterminated String Constant
Code: 0
URL: http://localhost/CRMSWeb/frmReferrer.aspx?REFSRC=undefined


Yunus Emre ALPÖZEN said:
Try document.getElementById('cboRefSrc').value not
document.getElementById('cboRefSrc').SelectedValue
--
Thanks,
Yunus Emre ALPÖZEN
null,'status:no;dialogWidth:550px;dialogHeight:350px;dialogHide:true;help:no
;scroll:no');

if (strReturn != null)
{
myArray = strReturn.Split("$");
document.getElementById('txtReferrer_Name').value=myArray[0];
document.getElementById('txtReferrer_TelNo').value=myArray[1];
}
}
 
C

Craig G

how silly do i look!! the code did have a Value instead of value

William F. Robertson said:
try debugging with this:

alert( document.getElementById('cboRefSrc').id );
make sure that is says: cboRefSrc

if that doesn't work then try

control = document.getElementByID( "cboRefSrc" );
if ( typeof( control ) == "undefined' )
alert( "Could not find control named cboRefSrc in the document." );

also try putting "debugger;" at the beginning of the OpenReferrer message.
Then you can step through your javascript code.

.value is in lowercase right?

HTH,

bill


Craig G said:
no that doesnt work either

the error i get for both is :-

Error: Unterminated String Constant
Code: 0
URL: http://localhost/CRMSWeb/frmReferrer.aspx?REFSRC=undefined


how
to
null,'status:no;dialogWidth:550px;dialogHeight:350px;dialogHide:true;help:no
;scroll:no');

if (strReturn != null)
{
myArray = strReturn.Split("$");
document.getElementById('txtReferrer_Name').value=myArray[0];
document.getElementById('txtReferrer_TelNo').value=myArray[1];
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top