Can I Add placeholder text to empty fields?

  • johnboy666
    Asked on June 7, 2016 at 11:40 AM

    Hi there,

     

    I have a form in use that does NOT require the user to complete every field and I'd like to keep it that way.

     

    BUT - Fields that are left empty are causing issues further down the line when I import into my Wordpress database.

    Is it possible to automatically add a "-" or similar to all empty fields when user clicks Submit?

  • David JotForm Support
    Replied on June 7, 2016 at 1:03 PM

    You could add a default value to each field. 

    Can I Add placeholder text to empty fields? Image 1 Screenshot 20

    Though, this would show the default value in the form, rather than the hint text.

  • johnboy666
    Replied on June 9, 2016 at 4:44 AM

    Hi David,

     

    Thanks for this. I did wonder about that but was hoping to keep the placeholder text.

     

    Having said that - I wonder if it was some kind of jotform bug as yesterdays forms all came through O.K.

  • Mike_G JotForm Support
    Replied on June 9, 2016 at 6:54 AM

    If I'm not mistaken, even if there is a placeholder, but fields are left unfilled and it is set as required, the form will still not submit. And, there is no option or condition to retain the placeholder text during submission. There is, also, no option available to fill empty fields during submissions nor there is a condition that will affect the behavior of the submit button and fill empty fields when it is clicked.

    With regards to what you said that happened yesterday, were you able to submit your forms with empty fields but it was filled automatically during submission? That seems odd because of what I have explained above. I'm not sure what happened, but if you encounter the same, please feel free to contact us anytime with more details. 

    You can also try to set default values to the fields, then, use Javascript so when the text fields are focused it will be cleared. This would mean, however, that you need to embed your form using its full source code.

    http://stackoverflow.com/questions/5324159/how-to-clear-text-field-on-focus-of-text-field

    Thank you.

  • johnboy666
    Replied on June 9, 2016 at 7:08 AM

    Hi Mike,

     

    Yes I was able to submit forms because the fields in question are not set as "required" and I'd like to keep it that way as not every field is required by all my users.

    However - Because I'm sending post data to Wordpress which uses that data to create a post/page on my website...

    This left me with an issue that meant the post/page was not created properly.

    I'll keep an eye on this and see how it goes over the next few days.

  • Nik_C
    Replied on June 9, 2016 at 8:55 AM

    What crossed my mind is that you could possibly use email submission for adding, for example: - . What I'm thinking is to edit your Notifier email and add - for every field, or at least for every not required field:

    Can I Add placeholder text to empty fields? Image 1 Screenshot 30

    You will get something like this in your email:

    Can I Add placeholder text to empty fields? Image 2 Screenshot 41

    Now, I'm aware that, this will add the - sign even if there is some text in it, but I'm not sure if this could work for you?

    Please let us know what do you think.

    Thank you!

  • johnboy666
    Replied on June 10, 2016 at 11:11 AM

    Ah I see - That's a good idea, I'll give it a try and report back.

     

    Thanks very much!

  • johnboy666
    Replied on June 17, 2016 at 5:51 AM

    Hi Nik,

     

    Just to update you - I have tried this but unfortunately it hasn't worked.

    I'm now thinking the issue is not with empty fields but some kind of coding problem.

    Unfortunately I'm not a developer so will have to get this looked at by a pro.

  • Nik_C
    Replied on June 17, 2016 at 8:59 AM

    I'm sorry that it couldn't work for you.

    If you need any help from our side, please let us know.