[FX.php List] Disable Fields?

Joel Shapiro jsfmp at earthlink.net
Thu Sep 3 15:22:59 MDT 2009


Hi Trish

Without making it a two-step process (first select type of cable and  
click submit, then If Digital display add-on options for second  
submit), you'll need JavaScript to enable/disable the add-on options.

If really you only need to keep the data in the database clean (i.e.  
never have a record with add-ons if the Cable field is "Basic") and  
don't need the user-friendlier enabling/disabing, then you could  
simply do a check in the PHP after submission before writing to the  
database.  If someone submits add-ons with Basic, you could either:
a) return the user to the form with a message saying they can't have  
add-ons with Basic and they need to change one or the other and re- 
submit, or
b) write to the database at time of initial submission but only set  
the add-ons if Cable is "Digital".  Then you could return a message  
saying the user has successfully signed up for "Basic", which has no  
add-on options available (so they were left off of the order).

Even if you use JavaScript to enable/disable the add-on options, it's  
probably a good idea to do the (b) validation in the PHP anyway, in  
case someone has disabled their JavaScript.

HTH,
-Joel

FYI: JavaScript is different than Java



On Sep 3, 2009, at 5:23 AM, VanBuskirk, Patricia wrote:

> I have a student cable TV order form using FX.php feeding into a FMP9
> database.
>
> Option A. is a radio button named "Cable" with a value of "Basic";
> Option B is a radio button also named "Cable" but with a value of
> "Digital".  Under the Digital section (B), there are add-on options to
> select (HDTV, DVR, etc) that are ONLY available to digital customers.
>
> The issue that has come up is this:  A student is signing up for  
> Basic,
> then selecting digital add-ons.  Is there a simple way to disable the
> add-on fields/options if "Basic" is chosen?  I'm pretty sure I could
> find some java script to do it, but would rather stay away from  
> java if
> possible, since people can disable it.
>
> Thanks,
> Trish
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list