cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Painter-Wakefield <paint...@mc.duke.edu>
Subject Re: xsp and selected option: HELP
Date Fri, 30 Apr 2004 15:07:53 GMT




Are you just trying to retain the selected option if there is an error on a
different part of the form?

I think you need to change this line:
<xsp:attribute name="value"><xsp-request:get-parameter
name="enquiry.postcode"/><esql:get-string column="id"/></xsp:attribute>

to instead be
<xsp:attribute name="value"><esql:get-string column="id"/></xsp:attribute>
<xsp:logic>
      if ((<esql:get-string
column="id"/>).equals(<xsp-request:get-parameter
name="enquiry.postcode"/>)) {
            <xsp:attribute name="selected">selected</xsp:attribute>
      }
</xsp:logic>

-Christopher




|---------+---------------------------->
|         |           Jason Lane       |
|         |           <jason@root10.net|
|         |           >                |
|         |                            |
|         |           04/30/2004 08:41 |
|         |           AM               |
|         |           Please respond to|
|         |           users            |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                       |
  |       To:       users@cocoon.apache.org                                              
                       |
  |       cc:                                                                            
                       |
  |       Subject:  xsp and selected option: HELP                                        
                       |
  >--------------------------------------------------------------------------------------------------------------|




HI list,

I'm using XSP, ESQL/SQL and simple forms I guess, the problem is this,
I have some select lists and I want to pass the "selected" attribute to
the one the user selects:

<option value="23" >one </option>
<option value="24" selected >two </option>
<option value="25" >three </option>

In my site map I have:

<snip>

And my XSP :
<snip>
             <select name="enquiry.postcode">
                         <option disabled="true">Please
select<xsp:attribute
name="value"></xsp:attribute></option>
                                     <esql:execute-query>
                                                 <esql:query>select id,
code from pcodeareas order by
code</esql:query>
                                                             <esql:results>

<esql:row-results>

       <option>

                   <xsp:attribute name="value"><xsp-request:get-parameter
name="enquiry.postcode"/><esql:get-string column="id"/></xsp:attribute>

                   <esql:get-string column="code"/>

       </option>

</esql:row-results>

</esql:results>
                                                 </esql:execute-query>
             </select>
</xsp-formval:validate>

I'm guessing that I could do this with a logic sheet? Or should I move
this to woody / cforms?

Many thanks all.






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


Mime
View raw message