Ghost - what it is how to use

jdran 28 Sep, 2015
I can't understand what ghost is and how to use it. Could you please give an example? I searched the forum but I couldn't derive a meaning.
GreyHead 28 Sep, 2015
1 Likes
Hi jdran,

The 'ghost' setting lets you set a default value for a radio, checkbox or checkbox group element. The problem with these elements is that if nothing is checked then *nothing* is submitted. The element is not included at all in the submitted data. This can cause a problem if you are using the form to edit an existing record and there is a previously saved value for the element as it won't be updated. Setting a ghost value - as an empty value, or something specific - ensures that a value is submitted and therefore the record will be updated.

The ghost works by adding a hidden input before the element with the same name. Because only the last of two elements with the same name is submitted this means that the ghost is over-written by any actual selection.

Bob
This topic is locked and no more replies can be posted.