I don't want it to! :-)

I'm using custom forms implementing a date field, then saving values manually to a node later. I could add an extra step preventing the value from being saved to the node, but I won't have the necessary info available to calculate whether to do this if it's an 'edit'.

Any ideas? I just dont want to save a value if the users doesnt enter anything. Seem's simple enough to me... :-S


By Form API reference you need to manually set '#default_value' to prevent it from defaulting to today. So just add:

'#default_value' => NULL,

to your field's array to prevent it.

  • thought i had tried that. sometimes it's easy to lose track of what's been tried tho ;-) thanks ill go give it another go – joevallender Aug 27 '13 at 14:32
  • @joevallender if that's not it, post relevant part of your form implementation. Or if you have time SSCCE of it. – Mołot Aug 27 '13 at 14:36
  • thanks, I'm actually working a significantly factored out proprietary set up of helper functions so it's a bit hard to communicate. it turns out this is no longer a requirement tho. oh well ;-) – joevallender Aug 28 '13 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.