The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
SOLVED: Ignore default field values if no data entered - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16) +--- Thread: SOLVED: Ignore default field values if no data entered (/showthread.php?tid=300) |
SOLVED: Ignore default field values if no data entered - invectus - Sep 23rd, 2009 Hi there, BTW This is a brilliant module, especially if you know what you're doing; I hope this can help me. I'm using Jquery to change the default value of a field on focus. If no data is entered into that field, the default value is displayed. I'm using this technique as a way to enrich the user's experience while filling the form instead of the old fashion <label> tag. The problem is that any field that wasn't filled returns it's default value to the database and I know you know how unfunny this is. I was hoping to tell the form to ignore any field that contained certain values. I would appreciate any help. RE: Ignore default field values if no data entered - Ben - Sep 23rd, 2009 Hey Invectus, Sure, no problem. There's a couple of ways you could do it. 1. JS approach: On form submit, right before the content is actually submitted, you could empty the fields 2. Use this module and add rules like so: PHP Code: if ($_POST["my_field"] == "default value") That's pretty much it! You would, of course, have to set up a pre-parser rule for your particular form and add the PHP above as the content. But there's no reason why it wouldn't work! Hope this helps - Ben RE: Ignore default field values if no data entered - invectus - Sep 23rd, 2009 (Sep 23rd, 2009, 6:26 PM)Ben Wrote: Hey Invectus, Ben, as alway's, you're very helpful. Let me give it a try and let you know what happened. Cheers, Invectus RE: Ignore default field values if no data entered - invectus - Sep 23rd, 2009 (Sep 23rd, 2009, 6:38 PM)invectus Wrote:(Sep 23rd, 2009, 6:26 PM)Ben Wrote: Hey Invectus, OMG Ben, This thing is nuts! I don't know if you realize how powerful FT2 is. If sold, it would cost lots. No kidding. It's working like a charm. I will be back with a few more questions and if you have some spare time, maybe you can use some of my annoying questions to detail how powerful FT is. Much appreciated bud, Cheers, Invectus RE: SOLVED: Ignore default field values if no data entered - Ben - Sep 26th, 2009 Hey Invectus. You just wait...! I'm working on a "Hooks Manager" module this weekend that lets you add custom HTML onto any webpage and attach any other code to any functionality in the UI. It's totally cool. The Submission Pre-Parser is basically just offering a very small subset of the Hooks Manager functionality. Of course it'll be completely bewildering to most folks, so I suspect I'll be spending an awfully long time documentating how it's used and examples... *sigh*. Still, it's really cool. - Ben |