Seek suggestions on making a javascript generating web application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GIMME

    Seek suggestions on making a javascript generating web application

    Background ...

    I've created a web application that allows a user to create an
    HTML application from IE.

    The application itself creates an XML representation of a XHTML
    form. The XHTML representation can be saved as a string and recreated.

    (The application also has a crude workflow aspect - so XMHTML forms
    can be created and assigned a workflow. Forget I said anything about
    the workflow - this is a java/javascript/design question.)

    Once the user has created an XHTML form he must create validating
    javascript for the input fields he's created. You know, check that
    dates are dates, that some fields are not empty, or numeric, or
    valid system login-ids. Same thing with select/drop down boxes.

    ....

    I have a proven library of javascript functions to use for validation.
    For example, I have functions IsDate() and IsNull() which would
    be used in a typical validation function :

    function Validate(aForm) {
    if (!IsDate(aForm. elements("start _date"),"Start Date") return false;
    if (IsEmpty(aForm. elements("must_ have_data"),"En ter Data") return false;
    return true;
    }

    (And then something like this ..)

    <form onsubmit="Valid ate(this);"/>

    Note that IsEmpty(), for example puts the focus on the current element
    and evokes an alert message about the element.

    ....


    I want the user to make javascript validation contingent.
    In other words, the end result might be :

    function Validate(aForm) {
    if (!IsDate(aForm. elements("start _date1"),"Start Date One") ) {
    if (!IsDate(aForm. elements("end_d ate1","Start Date One") ) return false;
    }
    if (!IsDate(aForm. elements("start _date2"),"Start Date Two") ) {
    if (!IsDate(aForm. elements("end_d ate2","Start Date Two") ) return false;
    }
    }


    So I need to create a web application (using both JSP(ASP) and javascript)
    allowing the user to select a form element, assign it a validation
    function, and then to select addtional elements and assign to them
    validation functions. As shown in Validate() above.

    The thing is. I can't get a grip on how to build the user interface.
    I can imagine two multi line select boxes where you click on one select
    box, identify an element, and then you populate a multi
    select box with names corresponding validation functions for that sort
    of element.

    But that doesn't take care of the contingency aspect.

    Any ideas?
  • Jeff Thies

    #2
    Re: Seek suggestions on making a javascript generating web application


    "GIMME" <gimme_this_gim me_that@yahoo.c om> wrote in message
    news:3f12b4fb.0 406161654.5a29e c61@posting.goo gle.com...[color=blue]
    > Background ...
    >
    > I've created a web application that allows a user to create an
    > HTML application from IE.
    >
    > The application itself creates an XML representation of a XHTML
    > form. The XHTML representation can be saved as a string and recreated.
    >
    > (The application also has a crude workflow aspect - so XMHTML forms
    > can be created and assigned a workflow. Forget I said anything about
    > the workflow - this is a java/javascript/design question.)
    >
    > Once the user has created an XHTML form he must create validating
    > javascript for the input fields he's created. You know, check that
    > dates are dates, that some fields are not empty, or numeric, or
    > valid system login-ids. Same thing with select/drop down boxes.
    >
    > ...
    >
    > I have a proven library of javascript functions to use for validation.
    > For example, I have functions IsDate() and IsNull() which would
    > be used in a typical validation function :
    >
    > function Validate(aForm) {
    > if (!IsDate(aForm. elements("start _date"),"Start Date") return false;
    > if (IsEmpty(aForm. elements("must_ have_data"),"En ter Data") return false;
    > return true;
    > }
    >
    > (And then something like this ..)
    >
    > <form onsubmit="Valid ate(this);"/>
    >
    > Note that IsEmpty(), for example puts the focus on the current element
    > and evokes an alert message about the element.
    >
    > ...
    >
    >
    > I want the user to make javascript validation contingent.
    > In other words, the end result might be :
    >
    > function Validate(aForm) {
    > if (!IsDate(aForm. elements("start _date1"),"Start Date One") ) {
    > if (!IsDate(aForm. elements("end_d ate1","Start Date One") ) return[/color]
    false;[color=blue]
    > }
    > if (!IsDate(aForm. elements("start _date2"),"Start Date Two") ) {
    > if (!IsDate(aForm. elements("end_d ate2","Start Date Two") ) return[/color]
    false;[color=blue]
    > }
    > }
    >
    >
    > So I need to create a web application (using both JSP(ASP) and javascript)
    > allowing the user to select a form element, assign it a validation
    > function, and then to select addtional elements and assign to them
    > validation functions. As shown in Validate() above.
    >
    > The thing is. I can't get a grip on how to build the user interface.
    > I can imagine two multi line select boxes where you click on one select
    > box, identify an element, and then you populate a multi
    > select box with names corresponding validation functions for that sort
    > of element.
    >
    > But that doesn't take care of the contingency aspect.[/color]

    Hmmm, I seem to be bottom posting...

    Why is that hard? Just add a start and stop date to your form.You can have
    your "validate type" rolldown turn the display style on/off for those
    textfields.

    Parsing the dates is a much harder problem, but you didn't ask about that.

    I'd probably skip the linked select boxes and just list all the form
    elements and possible validation routines for each. That way you can set all
    of them at .

    HTH,
    Jeff

    [color=blue]
    >
    > Any ideas?[/color]


    Comment

    • GIMME

      #3
      Re: Seek suggestions on making a javascript generating web application

      Doing what you suggest is easy, but there is a dependency issue
      that has to be built in that you are not getting., For example, you
      might want to set things up so that some input is not null
      only if a start date has been entered. And the start date might be optional.
      [color=blue]
      >
      > I'd probably skip the linked select boxes and just list all the form
      > elements and possible validation routines for each. That way you can set all
      > of them at .
      >
      > HTH,
      > Jeff
      >
      >[color=green]
      > >
      > > Any ideas?[/color][/color]

      Comment

      Working...