?
Solved

Displaying the error data in Red Color

Posted on 2002-07-30
7
Medium Priority
?
161 Views
Last Modified: 2013-12-24
On submitting the a form i need to check for the validation and post the data in red color before submiting to the server. Everything be done under same form. Redirecting the same pages for posting the errors.
waiting for your reply..

0
Comment
Question by:praveenkeerthi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 17

Accepted Solution

by:
anandkp earned 200 total points
ID: 7188021
Hi,

This is simple

1. create a list called javaerror & initialise it to ""

2. U could chk for validation & the fields that violate the validations .. could be traped in a list [javaerror] when the form is submitted back to itself.

so now when displaying the form, the javaerror has the fields that need to be displayed in red
so just chk for listcontainsnocase - & mark the specific one in red.

there ur done

let me know

K'Rgds
Anand
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7188044
Sounds like  a good approach to me.  Or You could always use Javascript to do this and not even worry about posting the form to itself.  Just have some hidden remarks next to each field and when the user hits submit the javascript validates the fields then makes visible the hidden remarks next to each field that is left blank.

Rather simple method I've used alot in the past and it works really cool.

I could give you some source code samples if you like.
0
 
LVL 6

Expert Comment

by:dash420
ID: 7188287
Do the java script validation and set hidden variable for each controls(mandatory contols of course). if any one fails in the validation. set the coressponding hidden variable and redirected to same page.

<script language="javascripts">
   function fnvalidate(){
     var bolfails = false
     if(document.formname.txtname.value == ""){
        document.formname.hdnname.value = 1
        bolfails = true
     }
     do same for other mandatory feilds
     ....
     ...

     if(bolfail == true){
        submited to same page
     }
     else{  
       submited to save page
     }

</script>

in the form just check

<cfif isDefined("form.hdnname")>
   <td><font color="red">Name</font></td>
<cfelse>
   <td>Name</td>
</cfif>
do same for the rest of the mandatory fields. of course for each mandatory feilds one separate hidden variable.



0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 6

Expert Comment

by:dash420
ID: 7188291
do following edit to the code.


<cfif isDefined("form.hdnname") and form.hdnname is "1">
  <td><font color="red">Name</font></td>
<cfelse>
  <td>Name</td>
</cfif>
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7192347
FormPage.cfm

<script language="javascript">
function validateFields(){
if(main.field1.value == ""){
document.all.fld1.style.visibility = "visible"
}
document.main.submit();
}
</script>

<form name="main" action="" method="post">
<table>
<tr>
    <td><input type="text" name="field1"></td>
    <td id="fld1" style="color:red;visibility:hidden">Please enter your first name.</td>
</tr>
<tr>
    <td><input type="button" name="but1" value="Submit" onClick="validateFields()"></td>
</tr>
</table>

this is a very simple example of how to achieve what you need withour having to post the form to itself.  You can very easily build off of this method and it's very effective.

KWK
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7219587
Hi ....

did this help ???

K'Rgds
Anand
0
 

Expert Comment

by:SpideyMod
ID: 8300827
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question