PDA

View Full Version : Javascript help



Ian Telfer
31-Jan-2006, 01:17 AM
Hi Guys,

I have a function I need to work, but for the life of me I cannot get it
to work;

<script language="javascript">
function DoActionCodeChange(){
var sDoActionCode = document.MainForm.Do_Asc_Action_Code.value
var MpRecId = document.MainForm.iMpRecId.value
var EwpRecId = document.MainForm.RecId.value
If (confirm("Are you sure you wish to do it?"))
window.location="EwpMain.asp?RecId="+EwpRecId+"&iMpRecId="+MpRecId+"&DoAction="+sDoActionCode+"";

}
</script>

The confirmation prompt works, but then I get an object expected error.,
and the window doesn't open. Any help would be really really appreciated.

TIA

Ian

Steven Wong
31-Jan-2006, 03:24 AM
Hi Ian,

Did you try location.href=""; or window.open("");? Why not submit() the form
instead?

Steve.

"Ian Telfer" <ian@cdrsystems.com.au> wrote in message
news:si4NF4iJGHA.4260@dacmail.dataaccess.com...
> Hi Guys,
>
> I have a function I need to work, but for the life of me I cannot get it
> to work;
>
> <script language="javascript">
> function DoActionCodeChange(){
> var sDoActionCode = document.MainForm.Do_Asc_Action_Code.value
> var MpRecId = document.MainForm.iMpRecId.value
> var EwpRecId = document.MainForm.RecId.value
> If (confirm("Are you sure you wish to do it?"))
> window.location="EwpMain.asp?RecId="+EwpRecId+"&iMpRecId="+MpRecId+"&DoAction="+sDoActionCode+"";
>
> }
> </script>
>
> The confirmation prompt works, but then I get an object expected error.,
> and the window doesn't open. Any help would be really really appreciated.
>
> TIA
>
> Ian

Ian Telfer
31-Jan-2006, 03:30 AM
Hi Steven,

I'm firing it off an onchange in a select object. The thing is the
confirmation message box pops up, but after confirmation the windows
doesn't change. If I remove the If (conf.. line, then the window
changes as expected.

I just want to be able to prompt the user before charging off and making
a massive change to the system.

Ian


Steven Wong wrote:
> Hi Ian,
>
> Did you try location.href=""; or window.open("");? Why not submit() the form
> instead?
>
> Steve.
>
> "Ian Telfer" <ian@cdrsystems.com.au> wrote in message
> news:si4NF4iJGHA.4260@dacmail.dataaccess.com...
>
>>Hi Guys,
>>
>>I have a function I need to work, but for the life of me I cannot get it
>>to work;
>>
>><script language="javascript">
>>function DoActionCodeChange(){
>>var sDoActionCode = document.MainForm.Do_Asc_Action_Code.value
>>var MpRecId = document.MainForm.iMpRecId.value
>>var EwpRecId = document.MainForm.RecId.value
>>If (confirm("Are you sure you wish to do it?"))
>>window.location="EwpMain.asp?RecId="+EwpRecId+"&iMpRecId="+MpRecId+"&DoAction="+sDoActionCode+"";
>>
>>}
>></script>
>>
>>The confirmation prompt works, but then I get an object expected error.,
>>and the window doesn't open. Any help would be really really appreciated.
>>
>>TIA
>>
>>Ian
>
>
>

Hans van de Laar
31-Jan-2006, 03:43 AM
Hi Ian,

Try changing window.location into something like newwindow =
window.open(EwpMain.asp?RecId="+EwpRecId+"&iMpRecId="+MpRecId+"&DoAction
="+sDoActionCode, "NewWindow", "resizable=yes, height=480, width=720,
top=100, left=100, fullscreen=no")

--
Regards,

Hans van de Laar
Micros b.v.
www.micros.nl


Ian Telfer wrote:

> Hi Guys,
>
> I have a function I need to work, but for the life of me I cannot get
> it to work;
>
> <script language="javascript">
> function DoActionCodeChange(){
> var sDoActionCode = document.MainForm.Do_Asc_Action_Code.value
> var MpRecId = document.MainForm.iMpRecId.value
> var EwpRecId = document.MainForm.RecId.value
> If (confirm("Are you sure you wish to do it?"))
> window.location="EwpMain.asp?RecId="+EwpRecId+"&iMpRecId="+MpRecId+"&D
> oAction="+sDoActionCode+""; }
> </script>
>
> The confirmation prompt works, but then I get an object expected
> error., and the window doesn't open. Any help would be really really
> appreciated.
>
> TIA
>
> Ian

Ian Telfer
31-Jan-2006, 03:44 AM
And the answer is - javascript is CASE SENSITIVE, don't expect If to do
an if.


Ian Telfer wrote:
> Hi Guys,
>
> I have a function I need to work, but for the life of me I cannot get it
> to work;
>
> <script language="javascript">
> function DoActionCodeChange(){
> var sDoActionCode = document.MainForm.Do_Asc_Action_Code.value
> var MpRecId = document.MainForm.iMpRecId.value
> var EwpRecId = document.MainForm.RecId.value
> If (confirm("Are you sure you wish to do it?"))
> window.location="EwpMain.asp?RecId="+EwpRecId+"&iMpRecId="+MpRecId+"&DoAction="+sDoActionCode+"";
>
> }
> </script>
>
> The confirmation prompt works, but then I get an object expected error.,
> and the window doesn't open. Any help would be really really appreciated.
>
> TIA
>
> Ian