PHP Classes

Cutomize Javascript

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Cutomize Javascript  >  (Un) Subscribe thread alerts  
Subject:Cutomize Javascript
Summary:How to enbed javascript to support field driven events.
Messages:5
Author:Moisey Oysgelt
Date:2009-01-21 13:45:34
Update:2012-01-17 14:01:09
 

  1. Cutomize Javascript   Reply   Report abuse  
Picture of Moisey Oysgelt Moisey Oysgelt - 2009-01-21 13:45:34
I wanted to make a simple data support between 2 fields to convert temperature units between Fahrenheit to Celsius and back. I wrote javascript functions , they work standalone but I have not find how to enbed it into you FORMS class.

What is the best way to do that , I plan to use your classes but Javascript in critical for my implementation.

Thank you Moisey O

  2. Re: Cutomize Javascript   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-01-21 16:57:33 - In reply to message 1 from Moisey Oysgelt
It depends on what you want to do. Probably you just need to assign the ONCHANGE or ONCLICK events of the inputs that trigger the conversion.

  3. Re: Cutomize Javascript   Reply   Report abuse  
Picture of Moisey Oysgelt Moisey Oysgelt - 2009-01-21 17:09:02 - In reply to message 2 from Manuel Lemos
The best way yo do this
like this
<INPUT ACCESSKEY="A" TYPE="text" NAME="test " onBlur="DoIt">
or
<INPUT ACCESSKEY="A" TYPE="text" NAME="test " onChange="DoTt">
I know how to do this in HTML or DHTML but how i put this in your script to make [onChange="DoTt"] code appear in generated code using your class

I used you class about 3 years ago, an I really like it. Now I need a little more advance way to inplemt application, an Javascript is very impotent component now.

Do you have something like extra attributes ?

Thank you


  4. Re: Cutomize Javascript   Reply   Report abuse  
Picture of Moisey Oysgelt Moisey Oysgelt - 2009-01-22 17:19:02 - In reply to message 2 from Manuel Lemos
I got it -

I can use 'ExtraAttributes '=> Array() in complicated cases
and
'ONCHANGE'=>'javascript',
'ONCLICK'=>'javascript',


thank you for nice implementation

Moisey O

  5. Re: Cutomize Javascript   Reply   Report abuse  
Picture of Erik de Bos Erik de Bos - 2012-01-17 14:01:09 - In reply to message 4 from Moisey Oysgelt

I think you can also use the SetInputProperty method. I've used it myself to display other inputs depending on content in the current input:

$form->SetInputProperty (
'selectInput',
'ONCHANGE',
'var selectInput = $("#selectInput option:selected").val();
if(selectInput == "yes") {
$("#hiddenInput").show();
}
if(selectInput == "no") {
$("#hiddenInput").hide();
}'
);