Hi Garrett

I was looking at the current solution for disabling the start price field for running auctions, which you describe in the code:

		// The user can only change the start_price when a product is not currently
		// being auctioned. The other times, we display it as a disabled textfield.
		// However, since disabled fields are not submitted by browsers, we need
		// to submit a value of the start_price when that is the case. If it is,
		// then we've already given start_price a #type of 'value' above, along with
		// other attributes which are used for textfields but not for values. Let's
		// duplicate that to make the visible (but disabled) textfield.

I was just wondering why you change the field type to 'value' and make a "fake" start price field to show as disabled, when the value isn't used in the 'update' op of hook_nodeapi anyway? Why not just disable the start price field?

Comments

Garrett Albright’s picture

Because the price field may be used in the 'validate' op, at which point we don't know what the auction state of the product is. At least, I think that was the reason…

Truth be told, really, that part of the code could use some reworking. I'm using hook_nodeapi() to do too much, so that there's a few hacky things here and there like that.

rsm08’s picture

Ok I found out why. The validation will fail if the start price field is empty. So it's reasonable enough I guess.