Complex Form Validation
We are trying to perform some complex form validaion with the new Validator plugin. Here is what we are trying to do: 1 -- validate a form field based on other form fields 2 -- validate a form field based on div style settings I know that I could solve the first problem with the old validation architecture, but is there a way to do that through the validator.xml? I'm not sure about the second problem. The code looks something like this div id=myDiv style=display: none //my form element here /div So is it possible to only validate the form element above only if the enclosing div display is block? I've looked, but couldn't find anything explaining how to go about this. Any ideas? Thanks in advance, George - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Complex Form Validation
Nick, Thanks for your response. I'm doing something similar with javascript. What would be better is if we could validate the form serverside with the validation framework... I think we would have to write a custom validator that somehow would get the div parent of the form field and check that before checking the actual field. Thanks, George George, I have done something similar to this. I haven't looked at browser compatability yet(we're currently using this with ie6), but the concept that I use is that I look at the parents of the form field, trying to find out if the element is hidden. If I find that a parent that is hidden, then I take appropriate action. My javascript loop looks like this: var hiddenParent = false; for(parent=formField.parentElement; parent != null hiddenParent == false; parent = parent.parentElement) { if(parent.currentStyle.display == none) { hiddenParent = true; } } if(hiddenParent) { etc, etc } Hope this helps a little. If there are better ways to do this, I'd love to get the feedback :-) Nick George Steimer [EMAIL PROTECTED]To: [EMAIL PROTECTED] m cc: Subject: Complex Form Validation 11/18/2003 02:18 PM Please respond to Struts Users Mailing List We are trying to perform some complex form validaion with the new Validator plugin. Here is what we are trying to do: 1 -- validate a form field based on other form fields 2 -- validate a form field based on div style settings I know that I could solve the first problem with the old validation architecture, but is there a way to do that through the validator.xml? I'm not sure about the second problem. The code looks something like this div id=myDiv style=display: none //my form element here /div So is it possible to only validate the form element above only if the enclosing div display is block? I've looked, but couldn't find anything explaining how to go about this. Any ideas? Thanks in advance, George - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: Struts and frames: what about the request scope?
I had this same problem on the project I am working on. Based on the functionality of the application, I could not put the form in session scope. I got around this problem by having each frame call an action that recreated the form bean in request scope and then forwarded to the frame jsp. George Its not found in the request scope of the frames because each frame has a DIFFERENT request. The browser will sent a seperate simultaneous request for each individual frame. If using session scope beware of potential concurrency issues as you will have multiple threads accessing the same form object. Probably wont be an issue if your just reading values for display though. -Original Message- From: Jeroen Breedveld [mailto:[EMAIL PROTECTED] Sent: Thursday, 30 October 2003 18:49 To: [EMAIL PROTECTED] Subject: Struts and frames: what about the request scope? Hi all, I'm trying to use struts with frame but the problem I have is that forms disappear from the request scope when I forward to an jsp containing a frameset to other actions like this: !-- jsp containing form submitting to someAction -- action path=/somePage forward=/WEB-INF/pages/some-page.jsp/ action path=/someAction input=/somePage.do name=SomeForm scope=request type=com.mycompany.actions.SomeAction forward name=success path=/framesetPage.do/ forward name=failure path=/somePage.do/ /action !-- jsp containing frameset -- action path=/framesetPage forward=/WEB-INF/pages/frameset-page.jsp/ The frameset-jsp.page contains a frameset like this: frameset framespacing=0 rows=50,*, html:frame frameborder=1 frameName=top-frame action=topFrame.do/ html:frame frameborder=1 frameName=bottom-frame action=bottomFrame.do/ /frameset Now in the actions topFrame and bottomFrame the form SomeForm does not appear in the request scope. Why is this? Rightnow I solved it by putting SomeForm in the session scope is that the only solution? I don't think that is a clean one anyway. Thanks for any help and regards, Jeroen -- X-Hive Corporation e-mail: [EMAIL PROTECTED] phone: +31 10 2818080 http://www.x-hive.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: Frames and IFrames in Struts
Thanks for your response. So, given that I can't simply persist the form bean -- is there a way that I can pass the information to each frame? We can't use a session bean because we need to have the ability to have multiple framesets up at the same time -- each with different information in the form bean. Thanks again, George snip when the framed pages load, they do not have access to the form bean. /snip The issue here is that for each frame the browser will send a seperate independent request to the server - its NOT the same request! You will therefore need to consider other ways of providing the frames with the information they need. Maybe use a session scoped form and forward through an action such that each frames jsp ends up with the same instance? (be aware that each frame is also processed by its own thread serverside so you may need to consider synchronization issues and suchlike). btw: Depending what it is you are doing maybe frames arent really what you want? For example if your just using them to get a 'templating' effect you might be better off using single pages and doing that templating using Tiles? -Original Message- From: George Steimer [mailto:[EMAIL PROTECTED] Sent: Tuesday, 28 October 2003 06:00 To: [EMAIL PROTECTED] Subject: Frames and IFrames in Stuts Hi, I am a relative newbie with struts and I am trying to utilize both frames and IFrames from within a struts web application. The application we are building has a form that submits to a jsp page that conatains a frameset. I am using the html:frame tag in the frameset, but when the framed pages load, they do not have access to the form bean. For the forward attribute of the frame, I have tried using both an action and a global forward, but neither works. Am I missing something? All I need to to is get the framed pages to read from the form bean that was submitted to the frameset jsp. Here is the source of the frameset JSP (excluding taglib declarations): frameset name=testFrameset cols=50%,* html:frame frameName=frameLeft forward=testFrameLeft / html:frame frameName=frameRight forward=testFrameRight / /frameset Here is the global forwards section of the struts-config.xml: global-forwards forward name=testFrameLeft path=/testFrameLeft.jsp / forward name=testFrameRight path=/testFrameRight.jsp / /global-forwards Also, the application we are building also utilizes iframes. I've searched the javadocs and a couple books, but I can't find a similar mechanism with struts. Is there a way to get request scoped parameters into the source of an Iframe? Any help is greatly appreciated! Thanks, George - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts cannot support relative uri ?
Do you have a html:base/ tag within your html head element? Hi, all. I am fajaven from matrix(www.matrix.org.cn) in China. I wonder it seems like Struts cannot support relative uri. In tomcat 5.0 , my webapp looks like: tomcat/webapps/asales Two files are: tomcat/webapps/asales/pages/left.jsp tomcat/webapps/asales/pages/images/logo.jpg Normally, in left.jsp, I use logo.jpg, like this: img src=images/logo.jpg/ but if in left.jsp include struts tags, or it mapping from struts action, then relative uri will fail, and absolute uri is required: img src=/asales/pages/images/logo.jpg/ You know, relative uri cannot be used is not convinient very much. How can I solve this question? Thanks. javen fang from matrix __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Frames and IFrames in Stuts
Hi, I am a relative newbie with struts and I am trying to utilize both frames and IFrames from within a struts web application. The application we are building has a form that submits to a jsp page that conatains a frameset. I am using the html:frame tag in the frameset, but when the framed pages load, they do not have access to the form bean. For the forward attribute of the frame, I have tried using both an action and a global forward, but neither works. Am I missing something? All I need to to is get the framed pages to read from the form bean that was submitted to the frameset jsp. Here is the source of the frameset JSP (excluding taglib declarations): frameset name=testFrameset cols=50%,* html:frame frameName=frameLeft forward=testFrameLeft / html:frame frameName=frameRight forward=testFrameRight / /frameset Here is the global forwards section of the struts-config.xml: global-forwards forward name=testFrameLeft path=/testFrameLeft.jsp / forward name=testFrameRight path=/testFrameRight.jsp / /global-forwards Also, the application we are building also utilizes iframes. I've searched the javadocs and a couple books, but I can't find a similar mechanism with struts. Is there a way to get request scoped parameters into the source of an Iframe? Any help is greatly appreciated! Thanks, George - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]