The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Validating via PHP if a text field is blank - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8)
+--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18)
+--- Thread: Validating via PHP if a text field is blank (/showthread.php?tid=1827)



Validating via PHP if a text field is blank - michatmaster7 - Dec 17th, 2011

I admit, this sounds dumb, but... using this bit of code:

Quote:if:FIELDNAME=VALUE,

How can I require another field to be required, IF a specific text field is left blank?

Is there a "value" for blank?


RE: Validating via PHP if a text field is blank - michatmaster7 - Dec 30th, 2011

I'm going to assume from the silence and lack of views to this thread that such an answer doesn't already exist. Sigh.

Here's what I have:

Name: {text field}
School: {text field}
Sponsor: {checkbox}

I need the Name and School field to both be required, but ONLY if the Sponsor field is left unchecked. Likewise, I need the Sponsor field to be required, but ONLY if the Name and School fields are left blank.

Ideas? Comments? Suggestions? You can tell me to stop thinking so hard, that would be ok, too..lol.




RE: Validating via PHP if a text field is blank - Ben - Jan 2nd, 2012

Hi Michatmaster,

Sorry for not getting back to you sooner! Actually yes, you can detect for the field being empty just by entering no VALUE. e.g.

Code:
rules.push("if:FIELDNAME=,required,SECONDFIELD,your error here.");

The syntax looks a bit weird, but it should work fine.

Let me know if you don't have any luck with it!

- Ben



RE: Validating via PHP if a text field is blank - michatmaster7 - Jan 11th, 2012

That works, but not for checkboxes that have only one option, see my other thread here: http://forums.formtools.org/showthread.php?tid=1847