RE: TEXTAREA element and Barracuda
Kirk Daries <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <D09B591872D1D611AF2B0010B5A1AAD05D426A@WCSMAIL> |
Hi Jake, The css styles aren't really a problem as you pointed out. For the past 6 months I've been moving away from Html tables etc etc... for layout...etc So everything is just a div or a span. Which I think is totally cool... Another approach I'm considering.. is to split my style sheets into 'style' and 'layout' sheets. As far as the Javascript functionality... I've developed a pretty sophisticated javascript framework... As such... I haven't been able to get a couple of things working. E.g. Disabling the back-button on a form submit etc etc. I use a wide range of scripts which include CurrencyFormatting, DateFormating and what not. Now that said... I've been considering using the BScript component to do this... because essentially. This is what it's for. Just haven't had the time yet to investigate how BSscript works yet. As far as a contrib project... Urmmm..... I'd really love to... ;) I have lots of cool things I'd like to showCase.... Such as Dynamically using different TemplateModels for a page. Which enables one to reuse your XMLC pages. And a couple of other cool things. I just have a deadline at the beginning of June... ;( My first Barracuda application is going live... So I don't know when I'm going to get round to this. Will keep this in mind though. Regards KD -----Original Message----- From: Jacob Kjome [mailto:[email protected]] Sent: 05 May 2003 12:31 To: [email protected] Subject: RE: [Barracuda] TEXTAREA element and Barracuda Hi Kirk, Sounds like a nice way to do things. Want to create a small contrib project demoing this approach? I'd be happy to commit it for you. Just model it after the existing contrib projects by Diez and Stefan. >The only drawback is that I do hardcode things like javascript and css styles. I wonder how much hard coding your really need to have? Rather than defining inline css styles, you can do it in one or more linked stylesheets. As for the javascript, you now have the capability of using a BAction component and specifying javascript functions that should be run on the client side before a form is actually submitted. For instance.... BAction bcomp = new BAction(); bcomp.addScriptFunction("checkMyForm"); What will happen on the client side is that the javascript function checkMyForm(objForm) will be called before any form submission happens. This assumes that checkMyForm() takes a form object as the first argument and returns a boolean. This allows you to be able to return false early, effectively short-circuiting the form submit in the case that the form hasn't validated properly. You can add as many script functions as you want. Do those suggestions get rid of the need to hard code javascript and css? Jake At 07:00 PM 5/2/2003 +0200, you wrote: Hi Jake, Yes...of course...your're correct. I did think of this. But there was a reason I implemented my TextArea's this way(and all other controls for that matter). I reuse a single XMLC page... and render the page differently deppending on the user's rights. These pages are used strictly for data entry.. E.g. A user needs to enter company information... let's say ...Company Name... <span class="Dir::Get_Data.ExampleModel.p_companyName">[THE COMPANY]</span> On the 'New' Screen... I'd might have a simple textBox... When the user edit's the record on the 'Edit' screen.. I might display a list(drop down) of registered Companies... (terrible example)... So. Instead of having 2 or 3 (New/Edit/View) Tags for a single field on the same page.. I have a single tag.. I have a interface that my all my dataAware models implement with mainly 3 methods. public interface HandlePresentation { public Object handleDefault(ViewContext vc,String key); public Object handleFind(ViewContext vc,String key); public Object handleNew(ViewContext vc,String key); public Object handleEdit(ViewContext vc,String key, BusinessRule businessRule); public Object handleView(ViewContext vc,String key, BusinessRule businessRule); . .More methods follow . } Depending on the 'event'.... I call the relevant method... (handleNew/handleEdit), etc This works great... and really cuts down on the number of tags I need to define. The only drawback is that I do hardcode things like javascript and css styles. That's about it. Regards KD -----Original Message----- From: Jacob Kjome [ mailto:[email protected] <mailto:[email protected]> ] Sent: 02 May 2003 06:19 To: [email protected] Subject: RE: [Barracuda] TEXTAREA element and Barracuda Hi Kirk, Why not have a <textarea> element with a BTemplate directive and return null if the condition says that it shouldn't be displayed? That should remove the element from the output, if I'm not mistaken. Jake At 03:55 PM 5/2/2003 +0200, you wrote: Hi, In the example.. I needed to conditionally create the textArea within the HTML page. It depends on the users rights.. E.g. A user with create or edit rights... would be presented with the textArea for updating.. A user with only 'View' rights would just see the 'text' without the textArea being rendered for updating. Here's the HTML snippet.. <span class="Dir::Get_Data.ExampleModel.Note">[TEXT AREA HERE]</span> Regards KD -----Original Message----- From: Diez B. Roggisch [ mailto:[email protected] <mailto:[email protected]> ] Sent: 02 May 2003 03:47 To: [email protected] Subject: Re: [Barracuda] TEXTAREA element and Barracuda Hi, Kirk Daries wrote: > } else if (key.equals("Note")) { > Document doc = vc.getTemplateNode().getOwnerDocument(); > Node targetNode = doc.createElement("TEXTAREA"); > View view = new DefaultView(targetNode); > BComponent b = new BComponent(); > b.setView(view); > b.setName("p_note"); > b.setAttr("class","TextBox"); > b.setAttr("id","M,NOTE"); > b.setAttr("cols","30"); > b.setAttr("rows","3"); > return b; Thats really complicated. In my TextAreaFormElement from the repopulation-package I simply return a BText (as Christian pointed out before). Then all this rows/cols/whatever stuff can be put in the html. <textarea class="Dir::Get_Data.ExampleModel.TEXTAREA" rows="3" cols="30"></textarea> Diez _______________________________________________ Barracuda mailing list [email protected] http://barracudamvc.org/lists/listinfo/barracuda <http://barracudamvc.org/lists/listinfo/barracuda> _______________________________________________ Barracuda mailing list [email protected] http://barracudamvc.org/lists/listinfo/barracuda <http://barracudamvc.org/lists/listinfo/barracuda>