You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by apurva zaveri <az...@yahoo.com> on 2002/10/21 22:42:27 UTC

Re: XMLForm having "-" like cocoon-action-next (Device Independence?)

I have come to a conclusion that either there has to
be way to submit an VXML page with field names like
"cocoon-xmlform-view" (Is there any way? I could not
find one.) like this

 <submit method="get" next="wizard?"
 namelist="cocoon-xmlform-view city propertyType rent
 cocoon-action-next"/>

(As I mention earlier VXML browser throws and
ECMAScript exception cuz of "-" in the variable name)

 or we need to make changes in XMLForm so that it is
in true practical sense "Device Independent Form".

By looking around the src I found out that Form.java
of XMLForm uses some constants from Constants.java

The following is the snippet of same:

from Form.java

snip--
   public static String  FORM_VIEW_PARAM =
"cocoon-xmlform-view";


snip--
    /**
   * filters custom request parameter
   * not refering to the model
   *
   * @todo implement default filtering
   * for standard Cocoon parameters
   * like cocoon-action[-suffix]
   *
   */
    protected boolean filterRequestParameter( String
name )
    {
    // filter standard cocoon-* parameters
    if ( filterDefaultRequestParameter( name ) )
return true;   
    
    // then consult with FormListeners
    Set ls = new HashSet();
    ls.addAll( Collections.synchronizedSet (
formListeners_ ) );
    Iterator iter = ls.iterator ();
    while (iter.hasNext())
    {
      FormListener fl = (FormListener) iter.next();
      // if any of the listeners wants this parameter
filtered
      // then filter it (return true)
      if ( fl.filterRequestParameter( this, name ) )
return true;
    }
    // if none of the listeners wants this parameter
filtered
    // then don't filter it
    return false;
    }
  
  
    /**
    * Filters the standard cocoon request parameters.
    * If default filtering needs to be different,
    * subclasses can override this method.
    * It is invoked before all listeners are asked to
filter the parameter
    */
    protected boolean filterDefaultRequestParameter(
String paramName )
    {
      if ( paramName.startsWith (
Constants.ACTION_PARAM_PREFIX ) 
        || paramName.startsWith ( Constants.VIEW_PARAM
) 
        ) 
        return true;
      if ( paramName.equals ( FORM_VIEW_PARAM ) ) 
        return true;
      else  return false;
    }
    
 
    /**
     * Try to extract from the request
     * and return the current form view
     */
    public String getFormView( Map objectModel )
    {
      Request request =getRequest( objectModel );
      return (String) getRequest( objectModel
).getParameter ( Form.FORM_VIEW_PARAM );
    }

*******************************************************


from Constants.java
snip--
    /**
     * The request parameter name to request a
specific view of a resource.
     *
     * FIXME(GP): Isn't this Servlet specific?
     */
    String VIEW_PARAM     = "cocoon-view";

    /**
     * The request parameter name to trigger a
specific action.
     *
     * FIXME(GP): Isn't this Servlet specific?
     */
    String ACTION_PARAM   = "cocoon-action";

    /**
     * The request parameter prefix to trigger a
specific action.
     *
     * FIXME(GP): Isn't this Servlet specific?
     */
    String ACTION_PARAM_PREFIX   = "cocoon-action-";
*****************************************************


So I am not sure if we need to fix this, if we need to
do v have to change the constants??

Or is there any other solution to this?


-Apurva



--- apurva zaveri <az...@yahoo.com> wrote:
> 
> --- mratliff@collegenet.com wrote:
> > 
> > I don't understand.  Is the error produced on the
> > client or the server?  
> 
> The error is produced in voiceXML browser [so
> client]
> The voiceXML browser expects this:
> 
> <submit method="get" next="wizard?"
> namelist="cocoon-xmlform-view city propertyType rent
> cocoon-action-next"/>
> 
> but it throws error cuz of "cocoon-xmlform-view" and
> is unable to execute the page. And on the server
> side
> cocoon expects to get "cocoon-xmlform-view" by http
> get method.
> 
> 
> Does
> > this markup:
> >       <var name="cocoon-action-next" expr="Next"/>
> > get transformed by xslt into a javascript variable
> > in the page sent to the
> > client?  
> 
> No.
> 
> Or is it part of the markup language of the
> > page?  Can you pass an
> > array in the namelist? i.e.,
> >       <submit next="wizard?"
> > namelist="Vars['cocoon-xmlform-view'], etc.
> 
> I havent tried this as I thought cocoons XMLForm
> would
> not accept it like this. Or am I confused? :)
> 
> > 
> > Sorry to be so thick; form elements commonly have
> > characters like "-" and "." in
> > their names; must be some way to work this out...
> 
> 
> 
> > 
> > --Michael
> > 
> > 
> > 
> >                                                   
>  
> >                                                 
> >                       apurva zaveri               
>  
> >                                                 
> >                       <azaveri@yahoo.co        To:
>  
> >     cocoon-dev@xml.apache.org,                  
> >                       m>                       
> > cocoon-users@xml.apache.org                       
>  
> > 
> >                                                cc:
>  
> >                                                 
> >                       10/19/02 10:21 PM       
> > Subject:  Re: XMLForm having "-" like             
>  
> >  
> >                       Please respond to        
> > cocoon-action-next                                
>  
> > 
> >                       cocoon-dev                  
>  
> >                                                 
> >                                                   
>  
> >                                                 
> >                                                   
>  
> >                                                 
> > 
> > 
> > 
> > 
> > 
> > --- mratliff@collegenet.com wrote:
> > >
> > > sorry, that should be:
> > >
> > >
> >
>
documents.forms[0].elements['cocoon-xmlform-view'].value
> > > also, if you need these to be variable names,
> use
> > an
> > > associative array:
> > >       var Vars=new Array()
> > >       Vars['cocoon-xmlform-view']="some view"
> > >       Vars['cocoon-action-prev']="some resource"
> > >       Vars['cocoon-action-next']="some resource"
> > > then
> > >       foo="cocoon-xmlform-view'
> > >       view=Vars[foo]
> > > etc.
> > 
> > oh nice. So the HTML problem is solved.
> > 
> > But in VXML you submit the form like this
> > 
> > <submit next="wizard?" namelist="city propertyType
> > rent"/>
> > 
> > The above statement is not a problem.
> > 
> > 
> > <var name="cocoon-action-next" expr="Next"/><!--
> > this
> vxml variable is actually
> > an javascript variable
> generated at the backend -->
> > 
> > <submit next="wizard?"
> >
>
namelist="cocoon-xmlform-view�city�propertyType�rent�cocoon-action-next"/>
> > <!-- even if i had an array I would have to
> > submit
> cocoon-xmlform-view variable.
> > how? -->
> > 
> > This gives an error.
> > 
> > -Apurva
> > 
> > 
> > 
> > >
> > > You guys are having way too much fun...
> > >
> > >
> > >
> > >
> > >
> > >
> > >                       apurva zaveri
> > >
> > >                       <azaveri@yahoo.co       
> To:
> > >     cocoon-users@xml.apache.org,
> > >                       m>
> > > cocoon-dev@xml.apache.org
> > >
> > >                                               
> cc:
> > >
> > >                       10/19/02 08:00 PM
> > > Subject:  XMLForm having "-" like
> > cocoon-action-next
> > >
> > >                       Please respond to
> > >
> > >                       cocoon-dev
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > XMLForm has form items named:
> > >
> > > cocoon-action-prev
> > > cocoon-action-next
> > > cocoon-xmlform-view
> > >
> > > all of them have "-" in it. Problem is
> javascript
> > > can
> > > not access such form items.
> > > i.e. you can not do
> > >
> > > documents.form.cocoon-xmlform-view.value
> > > or something like that.
> > >
> > > In HTML if you want to do this it will be an
> > > javascript error. [Although you may not run in a
> > > situation that demands to do that]
> > >
> > > But in VXML where all field in form are actually
> > > javascript variables you can not have a
> > field/js-var
> > > called "cocoon-action-next" as in javascript you
> > can
> > > not have a variable called "cocoon-action-next".
> > >
> 
=== message truncated ===


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForm having "-" like cocoon-action-next (Device Independence?)

Posted by apurva zaveri <az...@yahoo.com>.
I think I can use <goto> instead of <submit> in vxml

where I can say:

<goto
expr="http://www.gg.com/wizard?cocoon-action-next=Next"
/>

I will try that and let know if the problem can be
solved this way (This requires no changes to be made
in cocoon)

-Apurva Zaveri.


--- apurva zaveri <az...@yahoo.com> wrote:
> 
> I have come to a conclusion that either there has to
> be way to submit an VXML page with field names like
> "cocoon-xmlform-view" (Is there any way? I could not
> find one.) like this
> 
>  <submit method="get" next="wizard?"
>  namelist="cocoon-xmlform-view city propertyType
> rent
>  cocoon-action-next"/>
> 
> (As I mention earlier VXML browser throws and
> ECMAScript exception cuz of "-" in the variable
> name)
> 
>  or we need to make changes in XMLForm so that it is
> in true practical sense "Device Independent Form".
> 
> By looking around the src I found out that Form.java
> of XMLForm uses some constants from Constants.java
> 
> The following is the snippet of same:
> 
> from Form.java
> 
> snip--
>    public static String  FORM_VIEW_PARAM =
> "cocoon-xmlform-view";
> 
> 
> snip--
>     /**
>    * filters custom request parameter
>    * not refering to the model
>    *
>    * @todo implement default filtering
>    * for standard Cocoon parameters
>    * like cocoon-action[-suffix]
>    *
>    */
>     protected boolean filterRequestParameter( String
> name )
>     {
>     // filter standard cocoon-* parameters
>     if ( filterDefaultRequestParameter( name ) )
> return true;   
>     
>     // then consult with FormListeners
>     Set ls = new HashSet();
>     ls.addAll( Collections.synchronizedSet (
> formListeners_ ) );
>     Iterator iter = ls.iterator ();
>     while (iter.hasNext())
>     {
>       FormListener fl = (FormListener) iter.next();
>       // if any of the listeners wants this
> parameter
> filtered
>       // then filter it (return true)
>       if ( fl.filterRequestParameter( this, name ) )
> return true;
>     }
>     // if none of the listeners wants this parameter
> filtered
>     // then don't filter it
>     return false;
>     }
>   
>   
>     /**
>     * Filters the standard cocoon request
> parameters.
>     * If default filtering needs to be different,
>     * subclasses can override this method.
>     * It is invoked before all listeners are asked
> to
> filter the parameter
>     */
>     protected boolean filterDefaultRequestParameter(
> String paramName )
>     {
>       if ( paramName.startsWith (
> Constants.ACTION_PARAM_PREFIX ) 
>         || paramName.startsWith (
> Constants.VIEW_PARAM
> ) 
>         ) 
>         return true;
>       if ( paramName.equals ( FORM_VIEW_PARAM ) ) 
>         return true;
>       else  return false;
>     }
>     
>  
>     /**
>      * Try to extract from the request
>      * and return the current form view
>      */
>     public String getFormView( Map objectModel )
>     {
>       Request request =getRequest( objectModel );
>       return (String) getRequest( objectModel
> ).getParameter ( Form.FORM_VIEW_PARAM );
>     }
> 
>
*******************************************************
> 
> 
> from Constants.java
> snip--
>     /**
>      * The request parameter name to request a
> specific view of a resource.
>      *
>      * FIXME(GP): Isn't this Servlet specific?
>      */
>     String VIEW_PARAM     = "cocoon-view";
> 
>     /**
>      * The request parameter name to trigger a
> specific action.
>      *
>      * FIXME(GP): Isn't this Servlet specific?
>      */
>     String ACTION_PARAM   = "cocoon-action";
> 
>     /**
>      * The request parameter prefix to trigger a
> specific action.
>      *
>      * FIXME(GP): Isn't this Servlet specific?
>      */
>     String ACTION_PARAM_PREFIX   = "cocoon-action-";
>
*****************************************************
> 
> 
> So I am not sure if we need to fix this, if we need
> to
> do v have to change the constants??
> 
> Or is there any other solution to this?
> 
> 
> -Apurva
> 
> 
> 
> --- apurva zaveri <az...@yahoo.com> wrote:
> > 
> > --- mratliff@collegenet.com wrote:
> > > 
> > > I don't understand.  Is the error produced on
> the
> > > client or the server?  
> > 
> > The error is produced in voiceXML browser [so
> > client]
> > The voiceXML browser expects this:
> > 
> > <submit method="get" next="wizard?"
> > namelist="cocoon-xmlform-view city propertyType
> rent
> > cocoon-action-next"/>
> > 
> > but it throws error cuz of "cocoon-xmlform-view"
> and
> > is unable to execute the page. And on the server
> > side
> > cocoon expects to get "cocoon-xmlform-view" by
> http
> > get method.
> > 
> > 
> > Does
> > > this markup:
> > >       <var name="cocoon-action-next"
> expr="Next"/>
> > > get transformed by xslt into a javascript
> variable
> > > in the page sent to the
> > > client?  
> > 
> > No.
> > 
> > Or is it part of the markup language of the
> > > page?  Can you pass an
> > > array in the namelist? i.e.,
> > >       <submit next="wizard?"
> > > namelist="Vars['cocoon-xmlform-view'], etc.
> > 
> > I havent tried this as I thought cocoons XMLForm
> > would
> > not accept it like this. Or am I confused? :)
> > 
> > > 
> > > Sorry to be so thick; form elements commonly
> have
> > > characters like "-" and "." in
> > > their names; must be some way to work this
> out...
> > 
> 
=== message truncated ===


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org