Hi!
stupid me again :) I have a very simple widget that is supposed to collect a search string execute the search and show it in another widget. You'd think one would run into trouble because of interwidget operations, but no, everything fine on that front. My problem is that the value in the textarea for some reason doesn't get passed at all. If I put a constant string in the example, instead of using "self target" everything works just fine... Maybe it's simply too late at night, but it really beats me, there simply does not seem to be much that can go wrong in so little code... Berto My widget: Ambaradan.AmbaradanLocalizedWidget subclass: WidgetSearch [ <category: 'Widgets'> <comment: 'version 0.6.0' > | target | WidgetSearch class [ initialize [ "Registering the uuids of the text strings used by the GUI." <category: 'initialization'> super initialize. self guiAdd: #title -> 'Search'; guiAdd: #searchButton -> 'search'; guiAdd: #includeDef -> 'include definitions'; guiAdd: #help -> 'You can target expressions only or also look in definitions. Parenthesys and boolean operators can be used.'. ] ] doSearch [ <category: 'search'> | parser result | result := Ambaradan.SearchResult asResultOf: (self target) fromGateway: (self application gateway). self application history add: result. self application historyWidget markDirty. (self application searchResultsWidget) hasResults: true; index: 1; markDirty. ^self target: ''; markDirty; yourself ] target: aString [ <category: 'accessing'> ^target := aString ] target [ <category: 'accessing'> ^target ] contents [ <category: 'building'> ^[:e | | divImage divtitle form | divImage := e div id: 'search-image'. divtitle := divImage div class: 'sidebar-title title-right'. divtitle build: (self localize: #title). form := divImage form. (form textarea) cols: 17; rows: 2; action: [:val | self target: val]. form br. form build: (LocalizedButton new from: (self getText: #searchButton) withStatus: (self status: #searchButton) withAction: [self answer: self doSearch]). form br. form checkbox action: [:val | nil]. form build: (self localize: #includeDef). form br. (divImage div class: 'help') build: (self localize: #help) ] ] ] _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Got it... I'm not using a button to submit the form, but rather an
anchor. The reason i cannot use buttons is that we want button text to be "localisable in place", so it needs to show a "localization status" to authorized localizers (green, yellow, red ball for localized/fuzzy/missing status) and a MouseOver on this ball opens the localisation editor. Only I cannot seem to understand how I can submit a form using an anchor (a CSS button, that is)... Berto _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
I was trying to do this:
contents [ <category: 'building'> ^[:e | | divImage divtitle form submit | divImage := e div id: 'search-image'. divtitle := divImage div class: 'sidebar-title title-right'. divtitle build: (self localize: #title). form := divImage form id: 'searchForm'. (form textarea) cols: 17; rows: 2; action: [:val | self target: val]. form br. submit := form div build: (LocalizedButton new from: (self getText: #searchButton) withStatus: (self status: #searchButton) withAction: [self answer: self doSearch]). submit onClick: 'javascript:document.forms.searchForm.submit()'. form br. form checkbox action: [:val | nil]. form build: (self localize: #includeDef). form br. (divImage div class: 'help') build: (self localize: #help) ] ] it "kindof" made sense, too bad it doesn't work. Possibly it does submit only after doSearch is called... Any idea? Berto _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Bèrto ëd Sèra
Hi Bèrto,
On Sat, 14 Nov 2009 06:20:38 +0200 Bèrto ëd Sèra <[hidden email]> wrote: > Got it... I'm not using a button to submit the form, but rather an > anchor. The reason i cannot use buttons is that we want button text to > be "localisable in place", so it needs to show a "localization status" > to authorized localizers (green, yellow, red ball for > localized/fuzzy/missing status) and a MouseOver on this ball opens the > localisation editor. > > Only I cannot seem to understand how I can submit a form using an > anchor (a CSS button, that is)... > What I have in my current onlinetester: b := form radio beSubmitOnChange; id: id; name: group; action: [ self postAnswer: i to: frage ]. Looking into a fairly recent iliad source tree: $ grep beSubmitOn . ./Core/XHTMLElements/FormElementElement.st: beSubmitOnChange [ ./Core/XHTMLElements/FormElementElement.st: self beSubmitOnEvent: 'change' ./Core/XHTMLElements/FormElementElement.st: beSubmitOnClick [ ./Core/XHTMLElements/FormElementElement.st: self beSubmitOnEvent: 'click' ./Core/XHTMLElements/FormElementElement.st: beSubmitOnEvent: aString [ ./More/Examples/TodoListGridWidget.st: beSubmitOnClick; So I guess that form a beSubmitOnClick; ... should work. s. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Bèrto ëd Sèra
Hi Berto,
You are right, the form in your widget is never sent. There is a way to do it though: [:e | e form id: someString; build: [:form | form input action: [:val | self doSomethingWith: val]. form a text: 'submit'; onClick: 'iliad.evaluateFormAction(jQuery("#', someString,'"))']] HTH, Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (205 bytes) Download Attachment |
In reply to this post by Stefan Schmiedl
Le samedi 14 novembre 2009 à 11:34 +0100, Stefan Schmiedl a écrit :
> Hi Bèrto, > > On Sat, 14 Nov 2009 06:20:38 +0200 > Bèrto ëd Sèra <[hidden email]> wrote: > > > Got it... I'm not using a button to submit the form, but rather an > > anchor. The reason i cannot use buttons is that we want button text to > > be "localisable in place", so it needs to show a "localization status" > > to authorized localizers (green, yellow, red ball for > > localized/fuzzy/missing status) and a MouseOver on this ball opens the > > localisation editor. > > > > Only I cannot seem to understand how I can submit a form using an > > anchor (a CSS button, that is)... > > > > What I have in my current onlinetester: > > b := form radio > beSubmitOnChange; > id: id; > name: group; > action: [ self postAnswer: i to: frage ]. > > > Looking into a fairly recent iliad source tree: > > $ grep beSubmitOn . > ./Core/XHTMLElements/FormElementElement.st: beSubmitOnChange [ > ./Core/XHTMLElements/FormElementElement.st: self beSubmitOnEvent: 'change' > ./Core/XHTMLElements/FormElementElement.st: beSubmitOnClick [ > ./Core/XHTMLElements/FormElementElement.st: self beSubmitOnEvent: 'click' > ./Core/XHTMLElements/FormElementElement.st: beSubmitOnEvent: aString [ > ./More/Examples/TodoListGridWidget.st: beSubmitOnClick; > > So I guess that > > form a beSubmitOnClick; ... send a GET request, and evaluate the action associated to the link, but that's all. And if you think about it, anchors do send requests on click :p :p Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (205 bytes) Download Attachment |
Free forum by Nabble | Edit this page |