I'm not sure if I understand correctly how to use the Ghost value in a File Upload item.
I save the file name in a table field and I need to edit the records.
In the Ghost value text box I put {myname}.
When I reload a record it works ok.
The problem: the File upload field is not required. So {myname} (literal) is saved in the table even when I don't upload any file.
I'm confused.
Isn't the ghost value supposed to be used the way I'm using it?
Should I use php code instead?
Thank you
maxx
I save the file name in a table field and I need to edit the records.
In the Ghost value text box I put {myname}.
When I reload a record it works ok.
The problem: the File upload field is not required. So {myname} (literal) is saved in the table even when I don't upload any file.
I'm confused.
Isn't the ghost value supposed to be used the way I'm using it?
Should I use php code instead?
Thank you
maxx
Thank you Bob, but I know how to manage editing. :-)
What I found unexpected is the behaviour of the syntax {myname}.
I expected that when there's no myname value defined in the form, just like when creating a new record in a form, {myname} would be blank. That is what happens elsewhere in CF.
Anyway I'll use a custom code.
Thank you
maxx
What I found unexpected is the behaviour of the syntax {myname}.
I expected that when there's no myname value defined in the form, just like when creating a new record in a form, {myname} would be blank. That is what happens elsewhere in CF.
Anyway I'll use a custom code.
Thank you
maxx
Hi Maxx,
Sorry, then I just don't understand what you are trying to do. If you add {myname} in the Ghost Value box then that is - I think - treated as a string and will be submitted if the File Field element is empty. It is then included in the $form->data array and will be saved along with the other form data - exactly as you describe. ChronoForms won't replace {myname} with another value in that context - though you could do so using Custom Code.
Bob
Sorry, then I just don't understand what you are trying to do. If you add {myname} in the Ghost Value box then that is - I think - treated as a string and will be submitted if the File Field element is empty. It is then included in the $form->data array and will be saved along with the other form data - exactly as you describe. ChronoForms won't replace {myname} with another value in that context - though you could do so using Custom Code.
Bob
Hi Bob,
my question is about the behaviour of CF5 when it finds somewhere {something}.
I expected {something} to be substituted by a value when there is on load $form->data['something'] = 'a value' and
I expected {something} to be substituted by blank when $form->data['something'] is not set or is an empty string. That is what happens to curly brackets elsewhere in CF.
But when I use the curly brackets as a ghost value (in a file upload action), my 1st expectation is correct, the second one is not. So what happens is that my form (with a new record, not an edit) is submitted with
instead of
or
That is odd.
bye
maxx
my question is about the behaviour of CF5 when it finds somewhere {something}.
I expected {something} to be substituted by a value when there is on load $form->data['something'] = 'a value' and
I expected {something} to be substituted by blank when $form->data['something'] is not set or is an empty string. That is what happens to curly brackets elsewhere in CF.
But when I use the curly brackets as a ghost value (in a file upload action), my 1st expectation is correct, the second one is not. So what happens is that my form (with a new record, not an edit) is submitted with
$form->data['something'] = '{something}'
instead of
$form->data['something'] = ''
or
$form->data['something'] =
That is odd.
bye
maxx
Hi Maxx,
The {} syntax works in some places but not everywhere and apparently not in Ghost values. If you want an empty string then enabling the ghost and leaving the value empty should do that. But the result is probably the same as not using the Ghost value.
Bob
The {} syntax works in some places but not everywhere and apparently not in Ghost values. If you want an empty string then enabling the ghost and leaving the value empty should do that. But the result is probably the same as not using the Ghost value.
Bob
I don't know Bob, I used this same technique in 2 or 3 sites with CF4. It is in the FAQ (https://www.chronoengine.com/faqs/60-cfv4/cfv4-working-with-the-database/2666-how-can-i-edit-the-record-for-an-image.html) and there was a discussion in the forum to which I contributed with some suggestion and code (as you and other users did).
Apparently there's a bug in CF5 or there was a bug in CF4. 😉
If it's not a bug the FAQ should be updated.
bye
maxx
Apparently there's a bug in CF5 or there was a bug in CF4. 😉
If it's not a bug the FAQ should be updated.
bye
maxx
This topic is locked and no more replies can be posted.