Title: Formatting and validating fields
Last modified: December 18, 2018

---

# Formatting and validating fields

 *  Resolved [jarp](https://wordpress.org/support/users/jarp/)
 * (@jarp)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/)
 * Hello,
 * I have been working with happyforms and found a couple of issues I am not understanding
   how to implement them:
 * 1. Is there a way to format placeholder contents?. I need to center it and make
   it an H2. I notice there is a custom class, I have tried to use it but it doesn
   ´t pick up my css class. I put in the custom class the following: .jarp-navyblue
   h1. I tried with class=”.jarp-navyblue h1″ and it didn´t work. I have implemented
   the class in my child theme style.css.Could you kindly help me out with this?.
 * 2. I have a phone field and it is not being validated, is there a way to do it
   without writing JavaScript?
 * I am using Generatepress theme, GP plugin and WordPress 4.9.9.
 * Kind Regards,
 * JARP

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11001295)
 * Hey there, [@jarp](https://wordpress.org/support/users/jarp/) 👋
 * Happy to help you out with this one!
    1. Would you mind sending us an URL to your page? In general, you’ll want to put
       in just the name of a class to **Custom CSS class** field, without _dot_. That
       means it should read `jarp-navyblue` which then allows you to target it in your
       child theme’s CSS this way `.jarp-navyblue`. As it turns out, Placeholder part
       doesn’t allow heading tags to be added so while you can certainly make it look
       like `<h2>`, you’ll need to target your styles on `<p>` instead. Something like`.
       jarp-navyblue p` should do the trick.
    2. Could you please share more details about this? Are you using **International
       format** option in Phone part? Validation and formatting of phone number in 
       that case is real time, with additional backend validation on submit.
 * Let us know the details! 🙂
 *  Thread Starter [jarp](https://wordpress.org/support/users/jarp/)
 * (@jarp)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11010195)
 * Thank you!.
 * I have two phone fields on a form. One is using international format and the 
   other not. On both fields I type a 5 and I get no realtime or backend validation
   after submitting the form.
 * It tells me everything is Ok and presents the green box. Is there anyway I can
   put in a pattern and if so how?.
 * This is a site in construction and am working in localhost. I do have the site
   up on my host but not finished.
 * Kind Regards,
 * JARP
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11010998)
 * Oh I see, [@jarp](https://wordpress.org/support/users/jarp/).
 * Phone part actually uses phone formatting library which formats it automatically
   when **International format** is selected. As for now, there’s currently no option
   to insert a custom pattern. Sorry about that!
 * As for the phone number validation — you’re right, we currently don’t check if
   the number is actually a real phone number fulfilling all formatting rules for
   specific country. It’s something we’d like to improve for sure and we’ll definitely
   move our focus to it in a future releases.
 * Stay tuned! 🙂
 *  Thread Starter [jarp](https://wordpress.org/support/users/jarp/)
 * (@jarp)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11014109)
 * Thank you for clearing this up!.
 * On the other hand, could you be more explicit on point 1?. I am not versed in
   CSS.
 * This is what I have tried:
 * 1. Set the title name.
    2. Set the title name by writing the text of placeholder
   in the text editor of placeholder, the text is in bold and italics and formatted
   as bullet points. Here, it seem to inherit from the theme I use (GeneratePress
   and GP premium).
 * In custom class i just inserted jarp-navyblue and the simple code i used is for
   testing is:
 * .jarp-navyblue p
    { color: red; font-size: 40px; font-style: italics; }
 * This code is inside my child theme styles.css. On both points 1 and 2 the happyforms
   form is not picking up the CSS code.
 * Any help will be appreciated.
 * Thanks again and kind regards,
 * JARP
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11029038)
 * Hey [@jarp](https://wordpress.org/support/users/jarp/) 👋
 * Does adding `!important` to the end of each line before `;` help? Would you mind
   sending us your page URL? We’ll be happy to have a closer look.
 * Thanks!
 *  Thread Starter [jarp](https://wordpress.org/support/users/jarp/)
 * (@jarp)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11034081)
 * Unfortunately it did not work!.
 * Inspecting the placeholder field, it is targeted in a label and span from what
   I saw.
 * I am also confronting the issue that on the email field, and setting to display
   as placeholder, once the user inputs data and moves to the next field the placeholder
   moves down one line and overwrites the text input (on all browsers).
 * The site is under construction but I set up a test page located at:
 * [https://enersoft.tech/testsite](https://enersoft.tech/testsite)
 * Kind Regards and thank you,
 * JARP
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11046977)
 * Hey [@jarp](https://wordpress.org/support/users/jarp/),
 * Sorry to hear it didn’t work. We just wanted to check out your page to see for
   ourselves but it looks like you already removed Placeholder part from the test
   page. Would you mind adding it back in along with CSS code for it? We’ll be happy
   to point you in a right direction there.
 * As for the Email part in _Display as placeholder_ setting — thanks for reporting
   this! We noticed the issue and it’ll be fixed in next release which is scheduled
   to go out in a couple of days.
 * Let us know your thoughts! 🙂
 *  Thread Starter [jarp](https://wordpress.org/support/users/jarp/)
 * (@jarp)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11050599)
 * Thank you for your response.
 * I never removed the placeholder it is still there, upon inspecting placeholder
   text, it is contained within a <span> tag with a class=”label” and so it will
   not pick up my class .jarp-navyblue even though it is defined in custom class.
 * The only way I was able to style the placeholder text is if I put it in the text
   editor because it will be enclosed in <p> tag.
 * Thank you and Kind Regards,
 * JARP
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11050872)
 * Hmm, that’s strange, [@jarp](https://wordpress.org/support/users/jarp/).
 * Would you mind giving us more details on what you’re up to? From the description
   of the thread, we thought you’d like to style the text within **Placeholder**
   part. But looking at your page, that one doesn’t contain any text and the `jarp-
   navyblue` class is applied to **Short Text** part below it instead.
 * Let us know!
 *  Thread Starter [jarp](https://wordpress.org/support/users/jarp/)
 * (@jarp)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11052176)
 * Thank you for your response.
 * You are correct, I wanted to style the text within a placeholder. From what I
   see in happyforms you have a title field and a text editor field in placeholder
   part build. If I fill in the title field with text it will not be targetted in
   my CSS due to the behaviour I described.
 * If I put text in the text editor IT WILL be targetted in my CSS. It could be 
   my lack of understanding of both fields behaviour until I looked closer at them,
   I was trying to target the title field text.
 * In any case I have updated the testsite to reflect what I am explaining here.
 * Again, thank you very much for your help and kind regards,
 * JARP
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11071736)
 * That’s correct, [@jarp](https://wordpress.org/support/users/jarp/)!
 * The code discussed here was to change the appearance of Placeholder part body
   text, not its title. To target the title instead, you’ll want to change the selector
   to the following:
 * `.happyforms-part--placeholder .happyforms-part__label`
 * Hope this helps! 😀
    -  This reply was modified 7 years, 4 months ago by [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/).

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Formatting and validating fields’ is closed to new replies.

 * ![](https://ps.w.org/happyforms/assets/icon-256x256.png?rev=2778164)
 * [Happyforms - Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms](https://wordpress.org/plugins/happyforms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/happyforms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/happyforms/)
 * [Active Topics](https://wordpress.org/support/plugin/happyforms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/happyforms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/happyforms/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/formatting-and-validating-fields/#post-11071736)
 * Status: resolved