ops question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ops question

Alex Sharaz
Chaps,
Quick question

I'm writing an on line questionnaire using OPS (vsn 3.0 latest release)
and am looking for some suggestions as how to implement the following:-

1). A user logs onto a web server and I store their userid and e-mail
address in two session attributes, user.id and user.email

They then access my questionnaire. The XML instance I'm using has the
form
<survey>
  <datecompleted/>
  <user>
     <userid/>
      <email/>
  </user>
  <questions>
     <question1>
       .....
     </question1>
   ......
     <question2>
     </question2>
........
  </questions>
</survey>

I've generated a questionnaire which has 1 question per page and uses
the above XML instance and everything seems to work quite happily.

What I'd like to do is preload the XML instance with a given userid and
email address in the /survey/user/ section of the document so that upon
completion I pass a complete document containing all the info I require
off to the code that stores it in a database. Users are only allowed to
complete one copy of the questionnaire every month, so once the instance
is passed to the DB handler the userid anddate completed can be used to
determine whether the DB should be updated.

How would I configure path-flow.xpl (?) to preload the xml instance with
info from the session environment prior to using it in my questionnaire?

2). This is probably a really quick question. When I use a select or
select1 statement with appearance="full", when I use firefox to read the
xhtml file the select/select1 options are displayed 1 per line. When
running my ops application as an ops example (I've added my application
to /ops/WEB-INF/resources/examples/tutorial/ directory so I can see it
in the list of examples) All the select options are on 1 line. I'm
assuming that this is because of something in the config/theme/theme.xsl
file.

Is it possible to persuade ops to display select options 1 per line?

TIA
Alex

*****************************************************************************************
To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html
*****************************************************************************************

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: ops question

Erik Bruchez
Administrator
Alex Sharaz wrote:
 > Chaps,
 > Quick question
 >
 > I'm writing an on line questionnaire using OPS (vsn 3.0 latest release)
 > and am looking for some suggestions as how to implement the following:-
 >
 > 1). A user logs onto a web server and I store their userid and e-mail
 > address in two session attributes, user.id and user.email
 >
 > They then access my questionnaire. The XML instance I'm using has the
 > form
 > <survey>
 >   <datecompleted/>
 >   <user>
 >      <userid/>
 >       <email/>
 >   </user>
 >   <questions>
 >      <question1>
 >        .....
 >      </question1>
 >    ......
 >      <question2>
 >      </question2>
 > ........
 >   </questions>
 > </survey>
 >
 > I've generated a questionnaire which has 1 question per page and uses
 > the above XML instance and everything seems to work quite happily.
 >
 > What I'd like to do is preload the XML instance with a given userid and
 > email address in the /survey/user/ section of the document so that upon
 > completion I pass a complete document containing all the info I require
 > off to the code that stores it in a database. Users are only allowed to
 > complete one copy of the questionnaire every month, so once the instance
 > is passed to the DB handler the userid anddate completed can be used to
 > determine whether the DB should be updated.
 >
 > How would I configure path-flow.xpl (?) to preload the xml instance with
 > info from the session environment prior to using it in my questionnaire?

I would do it as follows:

1. Have your page model produce the pre-filled instance to its
    "instance" output.

    You do this by writing your page model as an XPL file, which
    extracts from the session the two attributes, and then inserts them
    into an XML document, which you send to the XPL's "instance"
    output. That document will then be available by the page view as
    its "instance" input.

    Now the trick is to extract the data from the session. OPS features
    a Scope generator processor which is able to read data from the
    session, however if the type of the attribute is String then it
    will try to parse that attribute as an XML document, which is
    probably not going to work in your case.

    One way to fix this would be to improve the Scope generator so its
    able to read string values without trying to parse them. In the
    meanwhile you can use the Java processor to produce those values
    from the session. This will require you to write a little bit of
    Java code.

2. Include your instance in your page view with:

    <xforms:instance id="my-main-instance">
      <xi:include href="input:instance"/>
    </xforms:instance>

 > 2). This is probably a really quick question. When I use a select or
 > select1 statement with appearance="full", when I use firefox to read
 > the xhtml file the select/select1 options are displayed 1 per
 > line. When running my ops application as an ops example (I've added
 > my application to /ops/WEB-INF/resources/examples/tutorial/
 > directory so I can see it in the list of examples) All the select
 > options are on 1 line. I'm assuming that this is because of
 > something in the config/theme/theme.xsl file.

Yes and no: you could control this in theme.xsl, but you can do this
with CSS as well, using for example:

.xforms-select1 span { display: block }

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws