PHP Classes

Selection trigger

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  >  Selection trigger  >  (Un) Subscribe thread alerts  
Subject:Selection trigger
Summary:Selection triggers static change on page
Messages:6
Author:Brian Read
Date:2008-07-29 11:22:21
Update:2008-08-04 05:15:15
 

  1. Selection trigger   Reply   Report abuse  
Picture of Brian Read Brian Read - 2008-07-29 11:22:21
I want to make part of a page "dependant" on the value of two fields on the page, In other words i want some of the fixed content to depend on the values in a couple of fields (i.e. controls), and when either of the control's contents change, then it needs to update the content. I suspect it is by using one of "ON" parameters in each of the controls, but it is outside my current understanding.

Can you suggest which one to use? and also give me some clues how to make it work (I guess in javascript?). The modified content needs some date arithmetic (add a constant number of days from a selection to a specified date and display the resultant date).

  2. Re: Selection trigger   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-07-29 23:09:33 - In reply to message 1 from Brian Read
Usually you use the ONCHANGE event.

If you want to tie several select inputs, you may want to try the linked_select plug-in that may be more objective for what you need.

  3. Re: Selection trigger   Reply   Report abuse  
Picture of Brian Read Brian Read - 2008-07-30 12:03:01 - In reply to message 2 from Manuel Lemos
I am already using the link_select plugin for something else, but in this case I need to do some arithmetic rather than change the options in a linked control.

The ONCHANGE event might well be what I want, presumably I need to load it with some javascript. Is there a resource which will help me identify how to do the code?

  4. Re: Selection trigger   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-07-31 07:20:36 - In reply to message 3 from Brian Read
It depends on what is involved in the arithmetic that you want to perform.

If you want to pick values of certain fields and make some calculations and assign some other field with the results, the class provides the GetJavascriptInputValue function to make the class generate a Javascript expression that evaluates to the current value of a given input.

You can also use the function GetJavascriptSetInputValue to make the class generate a Javascript statement that assigns a given input to a certain Javascript expression.

There are other helper functions to generate Javascript for your ONCHANGE event handling code. Take a look at the class documentation for functions with Javascript in the name.

  5. Re: Selection trigger   Reply   Report abuse  
Picture of Brian Read Brian Read - 2008-07-31 09:51:33 - In reply to message 4 from Manuel Lemos
aha - yes they look as if they might help me do the job, however I am having some trouble understanding how they can be used in practice - is there an example somewhere of there use?

  6. Re: Selection trigger   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-08-04 05:15:15 - In reply to message 5 from Brian Read
Some plug-ins use them to generate Javascript code to implement their functionality. You may want to take a look at plug-ins code.