Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Javascript in workflow
System
I am trying to put javascript in the wft (workflow file) in order to get a pop up confirmation alert message for one of the check box. It's giving me an javascript error. Does anybody know where should I put it exactly in my code. (within the <template_script> code or outside)
Here is my javascript code.
<script language="javascript">
function confirm_entry(){
input_box=confirm("Are you sure you want to send it.\n Click OK or Cancel to Continue");
if (input_box==true)
{
alert ("You have clicked ok");
}
else
{
alert ("You clicked cancel");
}}
</script>
Thanks
Find more posts tagged with
Comments
Migrateduser
I think you might be getting an error because of your actual Javascript code. By the way, what error are you getting? It'd be helpful also for you to attach your WFT file (which contains the Javascript code).
Dave
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
Migrateduser
Please look at the attached file and the error message i am getting is:
Invalid workflow:
Error: unexpected element
@line
17
Error:00001: Failure in operation
akshathp
have you defined this "input_box" variable that you are using?
Akshat Pramod Sharma
Migrateduser
I'm looking at it right now. The problem is that the HTML does not propagate the Javascript routine. If you view the source code on the rendered page, you can see this. I'm trying to figure out a solution -- will follow-up if I find something!
Dave
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
Migrateduser
Okay, if you were to move your Javascript routine down in your WFT file to just after your line that looks like this:
my $banner_html=<<EOS;
... so that your banner_html string would also contain the Javascript function, it will work.
Dave
P.S. I need to also mention that I added a backslash in front of your "\n" so that now it has TWO backslashes. This is necessary.
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
Edited by dave on 05/19/05 12:51 PM (server time).
Migrateduser
Thanks a lot. It worked with that javascript.
But when I changed my javascript code in order to get pointer to that checkbox, somehow it didn't work. Do you know what is this form actually called in the workflow. I have used "Forms" but not sure if it is correct. Please look in the attached code.
Migrateduser
You could look at the source code to find out, but if IW doesn't name the form, you could address it as "document.forms[0]", provided it's the first occuring form in the document. Otherwise, increment the integer in the forms array accordingly.
Dave
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
jbonifaci
You could also just give the field an id and then use document.getElementById().
Migrateduser
Very true, the DOM model is very nice to work with, especially when trying to parse / manipulate XML.
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
Migrateduser
It worked. Thanks all.
-Surnu
Migrateduser
it worked.... Thanks all.