This topic is locked

How to show conditional fields

6/9/2008 11:20:33 AM
PHPRunner General questions
J
jack knowles author

Hi Forum,
Table: suppliers

Fields: vat_registered, vat_number
I've set up the 'vat_registered' field as a lookup with the values 'Yes' and 'No'
On the suppliers_edit.php page, i need a way to achieve the following:

  • When the user first goes to the suppliers_edit.php page the fields should be set as:

    'vat_registed' - Please Select (Required)

    'vat_number' field should be hidden
  • The user is then forced to select the 'vat_registered' status of 'Yes' or 'No'.
  • If 'vat_registered' is selected with 'No' then leave field 'vat_number' hidden.
  • If 'vat_registered' is selected with 'Yes' then the 'vat_number' field is displayed and set to required
    Any help would be great
    JK

J
Jane 6/10/2008

Hi,
this task can be accomplished using JavaScript code on this page.

I recommend you to check following thread:

http://www.asprunner.com/forums/index.php?showtopic=6504
To define field as required use define() function. Here is a sample:

define('value_FieldName','IsRequired','FieldName: ');