Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
DCT reference
mk2004
Hi,
I am saving a DCT and before doing that i want to validate some file paths(in textfield, textarea etc....) for their existence. Also these fields are present in multiple replicants and in different cotainers. Is there a way to pass a refernce to the whole DCT rather than each individual element values in a CallServer function?
Thanks!
Find more posts tagged with
Comments
Migrateduser
Not sure I'm understanding the question, but if your validation rules are not too significant, why not validate with JavaScript instead of a server-side call? If you need to, you can probably pass the full path to the DCR and your server-side logic could parse and validate that.
Adam Stoller
I'm guessing the files only exist on the server-side so doing the entire thing within the 'local' FormAPI code won't work - they'd have to use CallServer() - but you could load all the different paths into an param object and have a single CallServer() call to a CGI that could validate all the paths and set the appropriate flags within the DCT from there.
Remember though that CallServer is asynchronous and that you have to have the 'traditional' saves/close functions return false, and have the CGI invoke a callback function that will ultimately perform the save/close routines (if appropriate) or post alerts and such as needed.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
mk2004
Instead of passing each field path into a param object, is there a way to pass the whole DCT as an object?
Dwayne
I don't believe that what you're asking for is possible in any reasonable way. You're constructing the request parameter with JavaScript, while you're probably READING it in something else (Perl, VB, whatever). Even if you COULD build a binary object that represented the entire DCR, and managed to load it into memory on the server CGI, it wouldn't be the right "format."
About the best you could home for would be to construct a string which represented the DCR. XML would probably be a good choice here. Then parse that string on the server side, to recreate the DCR. It's probably do-able, but far from trivial to implement.
--
Current project: TS 5.5.2/6.1 W2K
Adam Stoller
First, it's not a DCT you're passing - it would be the DCR
(the DCT is the template that describes the form, the DCR is the form with all of its contents)
Second, unless you've already saved the contents of the form as a DCR (which in this case, I believe you are trying to prevent until the information has been validated) there won't be a DCR to pass - all the information is simply living in the currently viewed form.
Hence, you need to create your own param object - extracting the inserting all the [as-yet-unsaved] field values in it to pass to your server-side CGI.
The only other alternative I can think of is to have a hidden field that requires being set (or set to a certain value) and a cgi-callout button labeled something like "Validate". In this scenario, you could have FormAPI code that checks the hidden fields value and if it isn't set "correctly" puts up an alert telling the user that they need to click the "Validate" button first (or perhaps you can even get this to happen automatically?).
The cgi-callout will have access to all the fields in the current DCT form, and is running on the server side, so your CGI script could process all the $cgi->{form}{...} elements and perform the validation, and then if satisfied, set the hidden element to the appropriate value.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com