By ultimante on
I overcome one obstacle and come across another.
I have my own custom tpl.php page for my flexinode forms. This works great for ADD, but for EDIT, it is not populating the values of the form items to what the previous values were. This is obviously because my values in the form input tags are static as "" (for ADD).
I can detect if it's an EDIT page, so how do I populate the form with the existing node values?
<input type="text" name="foo" id="foo" value="<?php if (arg(2) == "edit") { print [HOW DO I GET THIS VALUE] } ?>" />
Comments
Digging through flexinode.module...
$field = db_fetch_object(db_query('SELECT * FROM {flexinode_field} WHERE field_id = %d', $field_id));
Not sure if this is going down the right path or not...
Perhaps this?
theme('form_element', $label, $formatted_value)
Except this is a setter not a getter...
Must be drupal
I'm guessing that this is actually handled in Drupal and not Flexinode, that Drupal builds the edit node form based on the database structure of the flexinode in question. This is just a guess, though. I'm still digging but any pointers in the right direction would be most appreciated.
Solved
$node contains all the values
$node->foo returns the value of the associated form value.
how are you getting it to use your custom form?
does your template file handle generating an edit form for any flexinode content type? or did you just hardcode one for the particular content type you're using?
and how did you get it to be used in place of the default one? i've been trying to figure this out and so far it's defeating me :)