Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
using javascript in wft
cheeku
I want to include a javascript code in the wft. How can I do that?
Find more posts tagged with
Comments
Pommes
write a function with the js code and pass this code to the TAG_info in the html=> section somewhere. It is not the best war, but it works ;-)
cheeku
how do i identify the elements of the form(and the form)?
Pommes
The form is called iwwft_instantiator and you identify the elements with their names. Something like this:
$html .= "<script>";
$html .= "\n function disable(obj) { \n";
$html .= "\t if(obj) { \n";
$html .= "\t \t document.getElementById( 'Stunde' ).disabled = true; \n";
$html .= "\t \t document.getElementById( 'Tag' ).disabled = true; \n }} \n";
$html .= "function enable(obj) { \n";
$html .= "\t if(obj) { \n";
$html .= "\t \t document.getElementById( 'Stunde' ).disabled = false; \n";
$html .= "\t \t document.getElementById( 'Tag' ).disabled = false; \n } } \n";
$html .= "\n function checkStatus(){ \n";
$html .= "\t var radioObject = iwwft_instantiator.DeployType; \n";
$html .= "\t var valID = null; \n";
$html .= "\t for (var i=0; i<radioObject.length; i++) { \n";
$html .= "\t \t if(radioObject
.checked) { \n";
$html .= "\t \t \t valID = radioObject
.value; \n";
$html .= "\t \t \t if (valID == \"Express\") { \n";
$html .= "\t \t \t document.getElementById( 'Stunde' ).disabled = true;";
$html .= "\t \t \t document.getElementById( 'Tag' ).disabled = true; \n } \n break; }}}";
$html .= "</script>";
Was writen for an event based deployment.
Ottawa_IWOV
is there an OnClick event that will run validation javascript everytime the form is processed (i.e. When Start Job is clicked).
Lucas Cochrane
lucas.cochrane@baucanada.com
Solito
go an answer for this question ..?
Migrateduser
I don't think there's an option to directly change the attributes of the submit button (which is actually an image with a link around it, at least in 6.1), and it doesn't have an id, so it's hard to refer to it in javascript without iterating over all the elements and matching based on the innerHtml or something. Here's something you could try, however.
In you CGI_info section, provide some pre_tagtable_html which includes a script. This script should have your validator function, and it should set it as the eventhandler for the form, e.g.
document.forms.iwwft_instantiator.onsubmit = my_validator_function;
Then, when they submit the form, it should trigger your function.
However, that sounds like a really convoluted way to do things. Is there a reason that you can't set up perl functions for your various input tags with the valid_input option to TAG_info and do the validation you need there, returning appropriate error msgs with the error_msg option?