We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Change submitted data before it is written

Development and Programming

Eric Snyder's avatar
Eric Snyder
202 posts
17 years ago
Eric Snyder's avatar Eric Snyder

I want to change data in text fields before the data is written to the database table. Is there a hook that would be most appropriate here?

I found the list of hooks. Is there documentation of where the hook exists in the flow of processing?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

Couldn’t you do that with javascript? Onsubmit(), so to speak?

       
Justin Hurlburt's avatar
Justin Hurlburt
344 posts
17 years ago
Justin Hurlburt's avatar Justin Hurlburt

Hey Eric,

May I get a bit more information on which text field you are trying to modify? Also, by clicking the list of extension hooks you may access a page with information regarding the hook.

       
Eric Snyder's avatar
Eric Snyder
202 posts
17 years ago
Eric Snyder's avatar Eric Snyder

Justin:

I am looking to modify the contents of any text field on the page.

Thanks for the link. I was familiar with that resource. I think what I will have to do is week through the code and learn where the best hook would be. I tried some of the hooks and things happened at times that I was not expecting.

       
Jesse M's avatar
Jesse M
92 posts
17 years ago
Jesse M's avatar Jesse M

If you can’t find a hook that will do what you need, you might want to consider processing your GET / POST data in the path.php file, which is processed early in the EE request cycle.

       
Eric Snyder's avatar
Eric Snyder
202 posts
17 years ago
Eric Snyder's avatar Eric Snyder

Jesse: Interesting idea. Of course the intent of the extensions and hooks is to be able to not have to go back and edit source files that get overwritten with new versions. Does the path.php get overwritten with new upgrades?

       
Jesse M's avatar
Jesse M
92 posts
17 years ago
Jesse M's avatar Jesse M

I’m not sure, it might. But consider the following:

  • Customizing certain settings is an official use of path.php. For example, setting custom variables. See Path.php Global Variables

  • There are a lot of situations that the extension hooks don’t cover. path.php allows you to exert a lot of control that EE normally would deprive you of.

  • If you’re worried about it, put your custom code in it’s own file and just include() it in path.php – then you’ll only have one or two lines to maintain in path.php. It’s a small price to pay for the control it gives you.

An alternative that might work for your purposes is to use the ‘sessions_start’ hook, which is called pretty early in the EE request process.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

No, path.php does not get overwritten by upgrades. In fact, if you remove it or accidentally overwrite it, EE will no longer function properly.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.