TextArea synchronised selection

Hi,
I'm trying to write a hex viewer, where one TextArea shows
the hex values, and another the ASCII values, e.g.
41 42 43 44 ABCD
45 46 47 48 EFGH
I need the TextAreas to show a synchronised selection, so if
you select 42 -> 45 in the first box, area 1, B-E is selected in
the second box. I've overcome my first problem (that of the
TextArea control hiding selection on lost focus), but I can't seem
to find a nice way to synchronise the selections. There doesn't see
to be a selectionChanged event, and trying to use mouse click,
down, up or move fails in odd cases (e.g. when you move the mouse
off the control with the mouse still held down, the selection
changes but the events no longer fire).
Anyone have any bright ideas?
Thanks in advance,
Jon Rowland

Hello,
You could do like this
SELECTION-SCREEN BEGIN OF BLOCK BLCK1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_PROJ LIKE PROJ-PSPNR.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS: S_WBS FOR PRPS-POSID NO INTERVALS.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(79) TEXT-030.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(74) TEXT-031.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(34) TEXT-032.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BLCK1.
Cheers,
Vasanth

Similar Messages

  • Textarea on selection screen

    Hi all,
    Is it possible to create a textarea in the selection secreen of a report ? thus not pool-module program
    if its possible.how to do that ?
    Thanks in advance.

    Hello,
    You could do like this
    SELECTION-SCREEN BEGIN OF BLOCK BLCK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS: P_PROJ LIKE PROJ-PSPNR.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS: S_WBS FOR PRPS-POSID NO INTERVALS.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(79) TEXT-030.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(74) TEXT-031.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(34) TEXT-032.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK BLCK1.
    Cheers,
    Vasanth

  • How do I select a paragraph element spanning multiple lines

    Hi,
    I would like to retrieve the text from a JTextArea that surrounds the caret. What I mean by this is that I would like to select out the text around the caret that is a legitimate paragraph not the one associated with PlainDocument.
    ie.
    blah blah blah
    text text <caret> text
    text text text text
    blah blah blah blah
    In this scenario I would like to select out the two lines containing "text." I would like to do this without having to write my own code to parse the document. Your help is greatly appreciated.
    Thanks,
    John

    You could do something like this, although somewhat tedious. Hope it will help!
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class ParagraphSelectionTest
      public static void main(String[] args)
        JFrame frame = new JFrame("Paragraph selection");
        frame.setSize(500, 300);
        JTextArea tp = new JTextArea();
        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(new JScrollPane(tp), BorderLayout.CENTER);
        frame.getContentPane().add(new JButton(new ParagraphSelectionAction(tp)), BorderLayout.SOUTH);
        frame.setVisible(true);
    class ParagraphSelectionAction extends AbstractAction
      private JTextArea m_textArea;
      public ParagraphSelectionAction(JTextArea textArea)
        super("Select paragraph");
        m_textArea = textArea;
      public void actionPerformed(ActionEvent e)
        Element caretElement = ((PlainDocument)m_textArea.getDocument()).
            getParagraphElement(m_textArea.getCaretPosition());
        boolean bStartSet = false;
        boolean bFound = false;
        int nStart = 0;
        int nEnd = 0;
        for (Enumeration enum = ((AbstractDocument.BranchElement)caretElement.getParentElement()).children();
            enum.hasMoreElements(); )
          Element el = (AbstractDocument.LeafElement)enum.nextElement();
          if (!bStartSet)
            nStart = el.getStartOffset();
            bStartSet = true;
          if (el == caretElement)
            bFound = true;
          if (el.getEndOffset() - el.getStartOffset() == 1)
            if (el == caretElement)
              nEnd = nStart;
            if (bFound)
              break;
            else
              bStartSet = false;
          nEnd = el.getEndOffset();
        m_textArea.setSelectionStart(nStart);
        m_textArea.setSelectionEnd(nEnd);
        m_textArea.getCaret().setSelectionVisible(true);
    }

  • JTextArea selection color

    Hi
    I want to be abel to set diffrent colors in a textarea by selecting a
    interval of text och and then selecting a color.
    How is this done?
    I dont mean the selection color, the actual text. The purpose is to have an textarea with lots of news text, and be abel to color mark them for diffrent priority.
    Thanks.

    hi,
    JTextField, JPasswordField, and JTextArea each use a PlainDocument model. PlainDocument allows one font, one color, and is limited to character content. JEditorPane and JTextPane use a StyledDocument model. StyledDocument is much more complex, allowing multiple fonts, colors, embedded images and components, and various sets of hierarchically resolving textual attributes. So either use JEditorPane or JTextPane as per u'r requirement -
    -manoj

  • Selection on a TextComponent

    I need to select part of a TextArea and for this I use the select(int,int) method, after that I must send the focus to a TextField and I use therefore the Component.requestFocus method.
    Unfortunately executing the applet with the 1.5 Plugin the TextArea to be selected needs to have the focus, so when I send the focus to the TextField the selection disappears. It did not seem to behave this way until the 1.4 plugin version.
    Please note also that :
    1) I need to compile with an old compiler 1.2 to ensure compatibility with the Microsoft VM (my applet is destinated to lots of people that are not willing to install the Sun plugin).
    2) I cannot send the focus to the TextArea first , select and then send the focus to TextField as I need that the selection remains on the screen.
    Here's an example code :
    import java.awt.*;
    import java.awt.event.*;
    public class Prova extends Frame{
         TextField field;
         TextArea a;
         public Prova()
              setLayout(new GridBagLayout());
              addNotify();
              a=new TextArea("dsd");
              add(a, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
                                  GridBagConstraints.NORTHWEST,
                                  GridBagConstraints.BOTH,
                                  new Insets(1, 0, 1, 0),
                                  0, 0));
              field=new TextField();
              add(field, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,
                                  GridBagConstraints.NORTHWEST,
                                  GridBagConstraints.HORIZONTAL,
                                  new Insets(5, 0, 1, 0),
                                  0, 0));
              setSize(300,500);
              a.select(0,2);
              field.requestFocus();     
              public static void main(String [] args)
                   (new Prova()).setVisible(true);     
    }

    Can anybody give me an advice on how to cope with this problem?
    The way I implemented a program works perfectly until the 1.4, and the way I can implement in 1.5 (instead of selecting set the TextArea background with the SystemColor.textHighlight and the foreground with the SystemColor.textHighlightText) does not work with 1.4 and previous. I should therefore write the code twice :-((
    Thanks.

  • Highlight all Textarea text

    Hi Guys
    I have several text areas in a VBox called documentContainer. Now, what I want to do is when a user presses the "a" button the text in all the textareas is selected. I have managed to get it to partially work in that it'll select all the text in the current textarea, but it will not select the text in the other textareas. Code below:
    if(event.keyCode == 65) {
         for(var i:uint=0; i<documentContainer.numChildren; i++) {
               var taTextSelection:TextArea = documentContainer.getChildAt(i) as TextArea;
               taTextSelection.setSelection(0, taTextSelection.length);

    I believe this is how it is done:
    var myString:String = "test string";
    System.setClipboard(myString);
    You might not be able to read the clipboard once set in Flex though. You can in AIR. Here is another example I found on a blog:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in- flex/ -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            layout="vertical"
            verticalAlign="middle"
            backgroundColor="white">
        <mx:Script>
            <![CDATA[
                import mx.controls.Alert;
                private function button_click():void {
                    System.setClipboard(richTextEditor.text);
                    Alert.show("Done");
            ]]>
        </mx:Script>
        <mx:ApplicationControlBar dock="true">
            <mx:Button id="button"
                    label="Copy text to clipboard"
                    toolTip="Click here to copy the contents of the RichTextEditor control to the OS clipboard."
                    click="button_click();" />
        </mx:ApplicationControlBar>
        <mx:RichTextEditor id="richTextEditor"
                text="The quick brown fox jumped over the lazy dog."
                width="100%"
                height="100%" />
    </mx:Application>

  • Problem with fullscreen and TextArea

    I'm actually working to put a program in fullscreen mode. My interface is ok in fullscreen, I just got a problem with my TextArea. I don't arrive to get focus on them when it is in fullscreen...
    My cursor change, but I can't select the text inside.
    if someone got an idea?
    thanks,
    Thomas.

    It doesn't work. My textArea is selectable, but I begin to define my problem.
    When I'm in fullscreen, I don't arrive to get focus on the TextArea.
    myFocusListener = new FocusListener() {
                   public void focusGained(FocusEvent e) {
                        myProxy.sendFromComponentInt("selected", 1);
                   public void focusLost(FocusEvent e) {
                        myProxy.sendFromComponentInt("selected", 0);
    it never pass in focusGained when I'm in fullscreen mode, whereas it work fine in a classic Frame.
    I go in fullscreen mode like this :
    public void setFullscreen (){
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice gd = ge.getDefaultScreenDevice ();
         GraphicsConfiguration gc = gd.getDefaultConfiguration ();
         Rectangle windowBounds = gc.getBounds();
    // resize my interface to the size of screen
         sendFromWindowIntInt ("resized", windowBounds.width, windowBounds.height);
         //System.out.println("largeur : "+ windowBounds.width +" hauteur : "+ windowBounds.height);
         JWindow win = new JWindow () ;
         win.setContentPane(window.getContentPane());
         gd.setFullScreenWindow (win) ;
         win.requestFocus();
    Got an Idea?
    thanks a lot.

  • TABINDEX

    Hi,
        I have got a query for which I am trying to get a solution for about two days now.
        I have got a web form with a lot of input types like text, textarea, radio, select. And all these are overlayered with a transparent div. To avoid user interaction.
    Each input type has got a corresponding link by which on clicking, the div over it will be removed and data can be entered into that input.
    Consider this scenario. If I want to edit one textarea at the top of the page I ll be clicking the link for it and the div over it will be removed. Now if I press the tab key it will go to the next input type which is covered with the div and the user can type in even if that input type is covered with the div. That should not happen. So I gave the tabindex for all the input types as -1. But in IE its not working for radio buttons. For mozilla, its perfect. So I gave tabIndex -40000 for radio button only. I read somewhere that it will work. And it did. But as always, the next issue....  if I click the link for any radio button, the div over it will be removed. But now if I press the tab key it will go to the next radio button over which there is a div.
    I cant disable these input types and I strivctly have to use these over lays to restrict user interaction..How can I solve this issue.  Please help me out.
    Thanks in Advance...

    You could consider using Flash Foms which gives you access to the "Enabled" Attribute.  It's a boolean value that when set to false does not allow the user to interact with the control.  This way you could do away with the invisible divs completely and enable and disable controls without having to refresh the page and your tabs can stay the way they are.
    -Joe

  • Help me,JSP is not recognizing the class which in in jar under root of ear

    <%@ page import="com.sample.components.HttpUtil"%>
    I am not able to get the HttpUtil class in my JSP.Above is my declaration .I am getting compilation error.
    The HttpUtil class is under components package,which was in components.jar.
    And it is kept under root of ear.And the classpath for web is having entry of that jar.
    Please help me

    I changed the <form> in the jsp to div and its working fine. I do not need to have comments in JavaScript funcion() anymore. I don't know why that made the difference though? According to:
    http://www.w3schools.com/tags/tag_form.asp
    The <form> tag is used to create an HTML form for user input.
    The <form> element can contain one or more of the following form elements:
    <input>
    <textarea>
    <button>
    <select>
    <option>
    <optgroup>
    <fieldset>
    <label>
    An HTML form is used to pass data to a server.
    I do have <button> and also send the data - the value of checkboxes - to server. So I think it should also work with <form>.
    Please let me know if you have any idea. Thanks.

  • [SOLVED] Epiphany: Some videos of Youtube do not reproduce (html5).

    Hello, I have activated the option to see videos of Youtube using HTML5, with the browser ephipany (and with firefox) some videos can reproduce , instead, others do not reproduce, says in the screen of the video "Missing Plug-In" and afterwards "This video is currently Unavailable". I have installed the plugins of Gstreamer, but the problem persists.
    In the screen of activation of HTML5 says: What does my browser support?
    - Video tag
    - h.264
    - WebM
    These are the results of the HTML5 test
    your browser scores
    305
    AND 14 BONUS POINTS
    out of a total of 475 points
    You are using Epiphany 3.2.1 on LinuxCorrect?✔✘
    Parsing rules
    2 bonus points11
    <!DOCTYPE html> triggers standards mode    Yes ✔
    HTML5 tokenizer    Yes ✔
    HTML5 tree building    Yes ✔
    HTML5 defines rules for embedding SVG and MathML inside a regular HTML document. Support for SVG and MathML is not required though, so bonus points are awarded if your browser supports embedding these two technologies.   
    SVG in text/html    Yes ✔
    MathML in text/html    Yes ✔
    Canvas
    20
    canvas element    Yes ✔
    2D context    Yes ✔
    Text    Yes ✔
    Video
    8 bonus points21/31
    video element    Yes ✔
    Subtitle support    No ✘
    Poster image support    Yes ✔
    The following tests go beyond the requirements of the HTML5 specification and are not counted towards the total score. If browser support for one or more video codecs is detected, two bonus points are awarded for each codec.   
    MPEG-4 support    Yes ✔
    H.264 support    Yes ✔
    Ogg Theora support    Yes ✔
    WebM support    Yes ✔
    Audio
    4 bonus points20
    audio element    Yes ✔
    The following tests go beyond the requirements of the HTML5 specification and are not counted towards the total score. If browser support for one or more audio codecs is detected, one bonus point is awarded for each codec.   
    PCM audio support    Yes ✔
    MP3 support    Yes ✔
    AAC support    Yes ✔
    Ogg Vorbis support    Yes ✔
    WebM support    No ✘
    Elements
    22/29
    Embedding custom non-visible data    Yes ✔
    New or modified elements   
    Section elements    Yes ✔
    Grouping content elements    Partial ○
    Text-level semantic elements    Partial ○
    Interactive elements    Partial ○
    Global attributes or methods   
    hidden attribute    Yes ✔
    Dynamic markup insertion    Yes ✔
    Forms
    64/100
    Field types   
    input type=text    Yes ✔
    input type=search    Yes ✔
    input type=tel    Yes ✔
    input type=url    Yes ✔
    input type=email    Yes ✔
    input type=datetime    Partial ○
    input type=date    Partial ○
    input type=month    Partial ○
    input type=week    Partial ○
    input type=time    Partial ○
    input type=datetime-local    Partial ○
    input type=number    Yes ✔
    input type=range    Yes ✔
    input type=color    No ✘
    input type=checkbox    Yes ✔
    input type=image    Partial ○
    textarea    Partial ○
    select    Yes ✔
    fieldset    Partial ○
    datalist    Partial ○
    keygen    Yes ✔
    output    Yes ✔
    progress    Yes ✔
    meter    Yes ✔
    Fields   
    Field validation    Yes ✔
    Association of controls and forms    Yes ✔
    Other attributes    Partial ○
    CSS selectors    Yes ✔
    Events    Yes ✔
    Forms   
    Form validation    Yes ✔
    User interaction
    34/36
    Drag and drop   
    Attributes    Partial ○
    Events    Yes ✔
    HTML editing   
    Editing elements    Yes ✔
    Editing documents    Yes ✔
    APIs    Yes ✔
    History and navigation
    5
    Session history    Yes ✔
    Microdata
    0/15
    Microdata    No ✘
    Web applications
    15/20
    Application Cache    Yes ✔
    Custom scheme handlers    No ✘
    Custom content handlers    No ✘
    Custom search providers    No ✘
    Security
    5/10
    Sandboxed iframe    Yes ✔
    Seamless iframe    No ✘
    Related specifications
    Geolocation
    0/15
    Geolocation    No ✘
    WebGL
    10/25
    3D context    No ✘
    Native binary data    Yes ✔
    Communication
    32/36
    Cross-document messaging    Yes ✔
    Server-Sent Events    Yes ✔
    XMLHttpRequest Level 2    Partial ○
    WebSocket    Yes ✔
    Files
    10/20
    FileReader API    Yes ✔
    FileSystem API    No ✘
    Storage
    15/20
    Session Storage    Yes ✔
    Local Storage    Yes ✔
    IndexedDB    No ✘
    The Web SQL Database specification is no longer being updated and has been replaced by IndexedDB. Because at least 3 vendors have shipped implementations of this specification we still include it in this test.   
    Web SQL Database    Yes ✔
    Workers
    15
    Web Workers    Yes ✔
    Shared Workers    Yes ✔
    Local multimedia
    0/20
    Access the webcam    No ✘
    Notifications
    0/10
    Web Notifications    No ✘
    Other
    6/8
    Page Visibility    No ✘
    Text selection    Yes ✔
    Scroll into view    Yes ✔
    Experimental
    Audio
    0/7
    Web Audio API    No ✘
    Audio Data API    No ✘
    Animation
    0/2
    window.requestAnimationFrame    No ✘
    I do not know if this problem is caused by Epiphany, or because it is missing to install some package of Archlinux, would appreciate his answer, thank you in advance.
    Sorry for my English
    Last edited by Infragilis (2012-03-15 15:32:52)

    As it signalled the page of Youtube, expected this answer, but like my knowledge in this matter is scarce, had to ensure me that the problem was not the browser or the absence of a package.
    Thank you for answering

  • Non-ascii, jsp-struts, not reciveing the correct value in the server

    Hi,
    I am developing JSP-Struts based application using tomcat server. In JSP struts form, when I put nonascii charater in the text field or text area, on the server side I recived twice of that non-ascii character..
    for example, in the text field I entered following string:
    ------> This is text in tex field �&#131;
    On the server side, I get the following:
    ------> This is text in tex field �&#131;�&#131;
    Please notice, twice non ascii character.. :(
    I don't know how to resolve this.. Any help will be greatly appricated..
    Thanks,
    Ajay

    I changed the <form> in the jsp to div and its working fine. I do not need to have comments in JavaScript funcion() anymore. I don't know why that made the difference though? According to:
    http://www.w3schools.com/tags/tag_form.asp
    The <form> tag is used to create an HTML form for user input.
    The <form> element can contain one or more of the following form elements:
    <input>
    <textarea>
    <button>
    <select>
    <option>
    <optgroup>
    <fieldset>
    <label>
    An HTML form is used to pass data to a server.
    I do have <button> and also send the data - the value of checkboxes - to server. So I think it should also work with <form>.
    Please let me know if you have any idea. Thanks.

  • Style.css compatibility

    This may be a silly question, but I am trying to figure out what is wrong with my style.css file.I'm new at this and I'm getting compatibility issues with a color selection that I'm using and I don't know why. Dreamweaver is saying that it is incompatible in IE 6,7 Netscape 8 etc.
    Here is a sample of the code:
    12.      }
    13.      td, textarea, input, select {
    14.      font-family: Tahoma;
    15.      font-size: 10px;
    16.      color: c6c6c6;
    17.      font-weight: normal;
    18.      }
    Line 16 is giving me the error. Unsupported value:c6c6c6. But, the site shows perfectly in Chrome or Mozilla....
    Thanks,
    DJ

    Put a hash mark "#" in front of the color hex. Interesting that some browsers show it correctly without it, but all will be able to show it if you use the hash.
    Z
    To wit: #c6c6c6

  • Spry Password Question

    I've been reading a lot about spam protection for contact forms and I have heard a lot of people talking about honeypots. They say just use a field that you tell people not to fill out and if it is field out when submitted ignore the message. My client is tired of the messages all together and wants them to stop. Is there a way to use the spry password validation with a universal password? Then next to the password field I can just say enter this password for spam protection. I’m not opposed to using a honeypot if someone can show me how to block the message altogether. I’m running a script through Godaddy and here is the contact page. Don’t be brutal I’m a noob and keep this in mind when responding. Thanks

    Ok, here is what I found a YouTube video explaining how to use JQuery to submit a form on element change. View it here https://www.youtube.com/watch?v=pVnCkotKFLs
    I just can't seem to get it to work and how would I get it to redirect to the thank page on submit? Here is what I have -
    .js file
    $(document).ready(function () {
        $('#options').change(function()    {
            value = $(this).attr('value');
            if (value !== 'default')    {
              $(this).parent().submit();   
    .html file
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript" src="js/java/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="js/spam.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <div id="content">
                    <h1>Contact Us</h1>
                <h3>Fields marked with * are required</h3>
                <div id="contact-form">    
                <form action="/gdform.php" metod="post" name="form1" id="form">
                <p>*NAME<br />
                <input name="name" type="text" id="name" size="30" maxlength="40" />
                </p>
                <br />
                <p>*EMAIL<br />
                <input name="email" type="text" id="email" size="30" maxlength="40" />
                </p>
                <br />
                <p>PHONE<br />
                <input name="phone" type="text" size="30" maxlength="40" />
                </p>
                <p><br />
                *Comments<br />
                <textarea name="comments" cols="50" rows="10" id="comments"></textarea>
                </p>
                   <select id="options">
                           <option value="default">Not Human</option>
                        <option value="opt1">I'm Human</option>
                   </select>
                  <br />
                  <br />
                  <br />
                  <br />
                  <input type="reset" name="button2" id="button2" value="Reset">
                  <input name="recipient" type="hidden" id="recipient" value="[email protected]">
                  <input name="redirect" type="hidd
                  en" id="redirect" value="thankyou.html">
                  <br />
                    <p>
                  </p>
                </form>
                </div>
                </div><!-- end content -->
    </body>
    </html>

  • Server side form validation

    Hi exprets.
    How can i validate a form with jsp without the involvement of any client side script so that when a field is not filled properly it should display the form again with the data filled previously and a message against the incorrect field.
    I have a generic asp code that can be used with any form. There are some complexities in it for me in converting it to jsp because I am very net to it.
    Here is the asp code:
    validateForm.asp
    <%
    const errorSymbol = "<font color=red><b>*</b></font>"
    dim dicError
    set dicError = server.createObject("scripting.dictionary")
    sub checkForm
    dim fieldName, fieldValue, pFieldValue
    for each field in request.form
    if left(field, 1) = "_" then
    ' is validation field , obtain field name
    fieldName = right( field, len( field ) - 1)
    ' obtain field value
    fieldValue = request.form(field)
    select case lCase(fieldValue)
    case "required"
    if trim(request.form(fieldName)) = "" then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " is required</font>"
    end if
    case "date"
    if Not isDate(request.form(fieldName)) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & "must be a date</font>"
    end if
    case "number"
    pFieldValue=request.form(fieldName)
    if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a number</font>"
    end if
    case "intnumber"
    pFieldValue=request.form(fieldName)
    if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) or (instr(pFieldValue,".")<>0) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an integer</font>"
    end if
    case "email"
    if instr(request.form(fieldName),"@")=0 or instr(request.form(fieldName),".")=0 then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an email</font>"
    end if
    case "phone"
    pFieldValue=request.form(fieldName)
    pFieldValue=replace(pFieldValue," ","")
    pFieldValue=replace(pFieldValue,"-","")
    pFieldValue=replace(pFieldValue,"(","")
    pFieldValue=replace(pFieldValue,")","")
    pFieldValue=replace(pFieldValue,"+","")
    if Not isNumeric(pFieldValue) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a phone number</font>"
    end if
    case "login"
    Dim i, ch, login
    login = false
    pFieldValue = request.Form(fieldName)
    if len(pFieldValue) < 5 then
         login = false
    else
              for i=1 to len(pFieldValue)     
              ch = Mid(pFieldValue, i, 1)
                   if i=1 then
                        if(((ch >= "A") and (ch <= "Z")) or((ch >= "a") and (ch <= "z"))) then
                             login = true
                        else
                             login = false
                             exit for
                        end if
                   end if
                   if (i > 1) then
                        if(((ch >= "A")and(ch <= "Z"))or((ch >= "a")and(ch <= "z"))or((ch >= "0")and(ch <= "9"))or(ch = "_")) then
                             login = true
                        else
                             login = false
                             exit for
                        end if
                   end if
              next
         end if
         if login = false then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must start with an alphabet, having numbers (0-9), alphabets, the underscore and no spaces</font>"
    end if
    end select
    end if
    next
    end sub
    sub validateForm2(byVal successPage)
    if request.ServerVariables("CONTENT_LENGTH") > 0 then
    checkForm
    ' if no errors, then successPage
    if dicError.Count = 0 then
    ' build success querystring
    tString=Cstr("")
    for each field in request.form
    if left(field, 1) <> "_" then
    fieldName = field
    fieldValue = request.form(fieldName)
    tString=tString &fieldName& "=" &Server.UrlEncode(fieldValue)& "&"
    end if
    next
    Dim PageRed
    PageRed= successPage&"?"& tString
    response.Redirect(PageRed)
    end if
    end if
    end sub
    sub validateError
    dim countRow
    countRow=cInt(0)
    for each field in dicError
    if countRow=0 then
    response.write "<br>"
    end if
    response.write "<br> - " & dicError(field)
    countRow=countRow+1
    next
    if countRow>0 then
    response.write "<br>"
    end if
    end sub
    sub validate( byVal fieldName, byVal validType )
    %> <input name="_<%=fieldName%>" type="hidden" value="<%=validType%>"> <%
    if dicError.Exists(fieldName) then
    response.write errorSymbol
    end if
    end sub
    sub textbox(byVal fieldName , byVal fieldValue, byVal fieldSize, byVal fieldType, byVal fieldTitle, byVal maxLength, byVal action)
    dim lastValue
    lastValue = request.form(fieldName)
    select case fieldType
    case "textbox"
    %>
    <input name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(lastValue)
    end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" maxlength="<%=maxLength%>" <%=action%>>
    <%
    case "hidden"
    %>
    <input type="hidden" name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(lastValue)
    end if%>">
    <%
    case "password"
    %><input name="<%=fieldName%>" type="password" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write server.HTMLEncode(lastValue)
    end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" maxlength="<%=maxLength%>">
    <%
    case "textarea"
    %>
    <textarea name="<%=fieldName%>" rows="3" cols="<%=fieldSize%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" <%=action%>><%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(trim(lastValue))
    end if
    %></textarea>
    <%
    end select
    end sub %>
    End of validateform.asp
    and I use it like this:
    <!--#include file="includes/validateForm.asp" -->
    <%
         on error resume next
    %>
    <body leftmargin="0" rightmargin="0" topmargin="0">
    <%
         validateForm "addcustomer.asp"
    %>
         <form action="" method="post" name="form1" >
    <%validateError%>
    Customer Name
    <%textbox "Name", pName, 30, "textbox", "Customer Name", 50, ""%>
    <%validate "Name", "required"%>
    the last two scriptlets create a Name field which is required. If user does not fill it an error message appears against it.
    Can someone help me please.
    Sajid

    Wow... some ASP code... its strange to see ASP these days as its been ages since i have coded in ASP.
    Well to answer your question, there are couple of options to overcome this issue.
    1) Make use of Struts Framework. It automatically takes care for the error handling(ok not automatically), but error handling of the type you are looking for is built into it and one needs to modify according to his/her own application.
    2) The other option will be to submit the data to the servlet. Populate the data into the respective fields of a Bean and put the bean into session/request as per ur requirements. On the JSP page, check if there is some data in the bean. If yes, then populate the values of HTML controls from the BEAN and the one that is empty/has custom error that you might enter in servlet can be displayed as an error message to the user.
    Hopefully this works for you. Give it a shot and its correctly said, that "necessity is the mother of invention"

  • How to Install Spry for CS4?

    Hello,
    First off, sorry for such a newb question, but...
    I'm using Dreamweaver CS4. I've been reading about Spry and it sounds very interesting. I'm unclear on what I need to do to install and use it with Dreamweaver. I've downloaded the 1.6.1 version and an updater for CS4.
    Is there an actual installer I should run? Do I copy the files that extracted from the 1.6.1 download to a particular folder? Do I use Adobe Extension Manager to install?
    A step-by-step instruction of just what to do with these files to properly install them for use would be much appreciated.
    thanks very much!
    kim

    Welcome Kim!
    Check out the Spry Insert Bar right in Dreamweaver CS4: it includes
    Spry Data Set
    Spry Regions (Repeat, Repeat List)
    Form Validation (Text Field, Textarea, Checkbox, Select, Password, Validation Confirm, Radio Group)
    Spry Widgets (Menu Bar, Tabbed Panels, Accordion, Collapsible Panel, and Tooltip)
    There are many other Spry doo-dads and functionalities, all of which are explained and illustrated at: http://www.adobe.com/devnet/spry/
    Lots to sink your teeth into!
    Have fun!
    Beth

Maybe you are looking for

  • What is a Standard Data Source for table T006A?

    Dear Experts, As a part of one requirement I need to pull the data from Table T006A which is available in BW as well. I did many search on forums before posting the same but didnt get clear idea. I am aware how Units are being updated withing BW but

  • Canon 450D CR2 Files compatible with Photoshop Elements 7?

    I have recently bought a Canon 450D camera and have noticed that the RAW CR2 images produced are not compatible with my Photoshop CS2 version. I'm not sure about upgrading to the latest version of Photoshop since I probably wouldn't use all the featu

  • How to download the custom Tables to xls from the system?

    Hi How to download the custom Tables to xls from the system? Vijay

  • Opportunity.wsdl

    I have a requirement in which I need to create appointment in Oracle CRM on demand. For that I need to first query Opportunity data but I am not able to find Opportunity.wsdl in Admin section of Oracle CRM Application. Not sure if this is a permissio

  • Audio Assignment - sesx to mp3

    i need to be able to compile my mult. track into a mp3.. i cant get it to work.. help?