Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Support Forum



Reshowing a form posted to script code?
matt asked:
the docs for request.reshow() say:

"The setReshow() method will redisplay a user submitted form with any added field errors associated with fields displayed in that form. If the call is made from code that is not running in response to a user form submission, as in the case of a function called from a URL, the call is ignored. Note that the form redisplayed is always that form submitted by the user, regardless of the source of the script that contains the setReshow() call. "

My script codes call to setReshow() are being ignored even though the code is called in response to a post from the form on a view.  Is this supposed to work or is this supposed to be ignored? 

I'm trying to use that oh so nice error strings and keeping of values while doing a post to script code.  I have fields which are not data fields which also need to be processed so I can't process them in beforeinsert code. 

Other suggestions or alternatives are very much welcome.  Thanks.

Matt
 
  dougl responded:
  Response.setReshow() does not work on forms that post to scripts instead of tables.

My first suggestion would be to process your fields which are not data fields in scripts called in your BeforeInsert code.

If this isn't possible, you can always use response.setRedirect() and response.throwRedirect().

(In fact, if you look closely at errors generated by HotRAD pages integrated into the designer -- the module gallery, for instance -- you often see URLs with the error message encoded as part of the query string.

I would avoid doing this as much as you possibly can.)
 
  matt responded:
  Bummer.  How would I get access to the data which are not fields in the beforeInsert code or did you call separate script for those prior to the beforeInsert get's called?  Thanks.

Matt
 
  rossb (DataWeb) responded:
  Matt,
A handy way to do this that i have found is the following.

Instead of posting to a script file, post to the .view file itself (if there is a dataregion, make sure you are not in insert or update mode as you will end up posting to the table).

Then, at the top of the .view, put in some custom code to handle the post...

if (request.getMethod() == "POST")
  {
  }

in this code, load and call the script you are interested in.

in the script you can use response.addMessage (although i don't know if response.addFieldError works, try it).

then, when your script has completed, you can either redirect to somewhere else, or redisplay the view by simply returning.

after calling your script add code that looks like

if (response.hasMessages())
{
//write out your messages here...
}

you can use an error font to write the messages out at the top of the view.

It's not as handy as the automatic case, and we intend to improve this in the future, but for now, this basically lets you keep your script code simple.

Doug's solution works well, but when you perform the redirect, you have to encode up all the error messages, which can be a bit tedious.

Let me know if you have further questions about my proposed solution.

:)ross
 
  dougl responded:
  You can always use the request.getParameter() method to find the values of parameters that are not named after fields in your table.  
  dougl responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

Thanks,
DataWeb Support
 
  Please Log On
or create your own DataWeb Account.
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us