Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

XSL:Call Template


This topic is 7008 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Does anyone know of a way to call a XSL template from clicking a form button?

Also, is there a way to determine if a form checkbox is checked using XSL:If Test?

What I'm trying to do is to have a template with a loop in it that will run for each record in the found set. It will also add a record to the DB if a certain box in a form is checked on the page using something like:

I need the $hawkid variable to be based off a text field in the form as well.

Anyone know how to do this?

In theory this should all work fine, the problem is just being able to incorporate the form elements into this.

I've also attached the XSL file I'm working with so you can get a better idea of what I'm trying to do here if you like.

Thanks!

Andrew Rinner

Academic Technologies

University of Iowa

formsubmit.zip

Posted

I try to understand your code.

Is my assumption correct?

- first a query is sent to some database (I can't see its name) to get the titles of training courses and their associated sessions (which are in a portal)

- on the XSLT page you attached, the form is populated with this information

- the user can select from various sessions by clicking on a checkmark, and then submits this information to another database called sungod. There, the selected session numbers shall not be in a related table, but in a main table (or a table that is related to the user).

Can you confirm this? Then a solution should be possible.

And already a quick answer: No, you can't call a xsl:template from a form. In FMS7A CWP, XSLT is only output-oriented, you can't transform queries with it, they go directly to the database.

Posted

Martin, what you’ve listed is pretty much what I want to do.

The only thing is that I want to be able to create more than 1 record, depending on which sessions the user clicks on.

(A new record should be created with the user_id and session_id in a sepereate table for each session that the user checks on.)

Any ideas on the best way to do this?

Posted

Sorry, in your case my multiple records example is misleading. Only one related record can be created per request. We have to rethink your solution.

It's the cherry picking case about which I am thinking since two weeks now. It can be rather easily solved with a GET request (however, the length of a GET query is limited), it's however difficult with a POST.

Posted (edited)

I guess it could work along the following line:

- Submit a token for each session

- on the next XSLT page, evaluate the tokens and add for each token that matches a new record with XSLT document().

See attached file. Not tested, probably not free of typos.

This should work if there are not too many sessions.

In my cherry-picking case I can have >>100 records, and I have to work differently (probably with some JavaScript and separation operators).

submitmultiple.zip

Edited by Guest
Posted

I was able to get this working actually.

What I did was to load a page that lists all of the possible sessions a person can sign up for in a related set through a portal. It also loads a checkbox that has the name of the checkbox the same as the field name, and the value equal to the session_id.

This page then performs a fine and goes to another page. This page loops once for each record in the found set, and performs an XML request to add each record. There's also a token that's used to hold the user_id to add each record.

Seems to work great!

Posted

Oh yes, that's an elegant solution. Did you do the find with -lop=or? What happens if the same session id was assigned to various courses? Is this possible?

I wanted to avoid any find or edit, that's why my proposed solution used tokens to pass the info.

Posted

Yes I used a -lop=or for this as well in the find query. The way this database is setup is to have a unique session_id for each session, so I haven't run into the 2nd issue you mentioned yet, but it could possibly be an issue when sessions had the same id.

This topic is 7008 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.