• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Is it possible to use Bootstrap to validate form without using JavaScript?

 
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I used to use javascripts/jquery/regex to validate form.  But, that was back in 2010.

I wonder how things have changed now and what are the latest trends in doing things?

Currently, I am using Bootstrap, I wonder if Javascript is still necessary or can we just  use Bootstrap alone to validate form and make sure the fields are not empty?

What are the techniques we can use, should the user disabled javascripts in their broswer?

My app is using Java 8 with Java EE and tomcat.

Tks.

 
Rancher
Posts: 1170
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the only thing you need to do is make sure that the inputfields aren't empty, you can add required to your input tags.
Otherwise there's always jsp or jsf
 
tangara goh
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:if the only thing you need to do is make sure that the inputfields aren't empty, you can add required to your input tags.
Otherwise there's always jsp or jsf



<code>
<div class="control-group form-group">
<div class="controls">
<label>Address 1:</label> <input type="text" class="form-control" <br /> id="address1" name="address1" required <br /> data-validation-required-message="Please enter your blk no.">
</div>
</div>
</code>

So, like the above it should be ok?

However, I noticed that whenever I leave blank, the message Please enter your blk no is not appearing.

Have I missed something?
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot put HTML element in the middle of other HTML elements.
 
tangara goh
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You cannot put HTML element in the middle of other HTML elements.



I am sorry but I do not get what you mean.

 
Bear Bibeault
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

tangara goh wrote:

Bear Bibeault wrote:You cannot put HTML element in the middle of other HTML elements.


I am sorry but I do not get what you mean.


Perhaps it's just that the code in your post is badly formatted. Please post your code again, and be sure to UseCodeTags to make sure that the formatting of the code is correct.
 
Marshal
Posts: 3149
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rather than formatting your HTML using an HTML <code> tag, use the JForum editor's Code button (select JavaScript for best syntax highlighting).  What you posted before shows some embedded <br /> tags inside the <input> tag.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic