[eluser]TheFuzzy0ne[/eluser]
[quote author="Moobies" date="1241118178"]
in fact, the set_value with a default on a create form (i.e. with no backing object) would cause a php error, so you'd either have to check for non-null or suppress the error, e.g.[/quote]
That only happens if you haven't loaded the form_validation library, or at the very least, the form helper.
[quote author="Moobies" date="1241118178"]
Code:
<input type=“text” name=“name” value=”<?php echo set_value(‘name’, @$myobj->name) ?>” >
again, i think this is ugly when there is already conditional checks in the controller to determine whether a create or edit is happening.[/quote]
To each his own. Personally, I think that's the best way to go. However, I'm still confused... I've seen a lot of examples, but I'm not entirely sure what you're proposing. From what I can tell, you're only proposing you change the inner workings of the method in a way that can cause problems (by messing with the postdata). It achieves the same effect, only it gives you more unpredictable results.
[quote author="Moobies" date="1241118178"]
set_value in the controller does not have any influence on the form input helper version of set_value and that's because set_value is actually returning the default value from the function. my solution actually places the value in the Form_validation's internal data array so it's found by the alias helper version too.[/quote]
Sorry. I'm still lost... You have to set the default value regardless, to me it makes sense to be able to print an alternative if the form hasn't been submitted, and that alternative should be supplied when we're requesting the data.
[quote author="Moobies" date="1241118178"]
i still think my way is better unless you can convince me otherwise

)[/quote]
At the moment I'm not trying to convince anyone of anything. I'm just trying to get my head around what you're proposing. It just doesn't make any sense to me which is why I think I've misunderstood what you've said somewhere.