Hello,
I am looking for the best way to get the values entered into a form (without using Formula). For example, I have a text input field, I want to get the value on that field and execute some Smalltalk code using that value whenever the user presses the submit button. Is there a similar way to get the values like we do using $_POST global variable in PHP or some other way? Canol |
Hi Canol,
In Iliad, we only think in action blocks. For example, the counter (using GET requests) looks like: e a action: [self increase]; text: '++' But it could be written with a form using POST requests: e form button action: [self increase]; text: '++' As you can see, you don't have to deal with low level details, Iliad handle them for you. A typical form in Iliad would look like: e form build: [:form | form input action: [:string | self doSomethingWith: string]; value: 'default value'. form button text: 'Ok'] HTH, Nico signature.asc (205 bytes) Download Attachment |
Very nice, thank you...
On Jun 3, 1:05 pm, Nicolas Petton <[hidden email]> wrote: > Hi Canol, > > In Iliad, we only think in action blocks. > > For example, the counter (using GET requests) looks like: > > e a > action: [self increase]; > text: '++' > > But it could be written with a form using POST requests: > > e form button > action: [self increase]; > text: '++' > > As you can see, you don't have to deal with low level details, Iliad > handle them for you. > > A typical form in Iliad would look like: > > e form build: [:form | > form input > action: [:string | self doSomethingWith: string]; > value: 'default value'. > form button > text: 'Ok'] > > HTH, > Nico > > signature.asc > < 1KViewDownload |
I have some trouble processing more than one form value. Say, I have
two fields like title and body for writing a blog entry, I created two instance variables called title and body for the ILWidget (which creates the form to post the entry). I try a code like below in the contents message of the widget: e form build: [:form | "this is the title field" form input action: [:string | "here is a message to self to assign the value to title instance variable"]; value: 'default value'. "this is the body field" form input action: [:string | "here is a message to self to assign the value to body instance variable"]; value: 'default value'. form input type: 'submit']; onSubmitDo: ["here is the message to add the entry"]. It appears that the onSubmitDo: block is executed before field values are assigned. How can I solve this problem? P.S. Sorry for asking too much -basic- questions :) Canol On Jun 3, 2:10 pm, ZuLuuuuuu <[hidden email]> wrote: > Very nice, thank you... > > On Jun 3, 1:05 pm, Nicolas Petton <[hidden email]> wrote: > > > Hi Canol, > > > In Iliad, we only think in action blocks. > > > For example, the counter (using GET requests) looks like: > > > e a > > action: [self increase]; > > text: '++' > > > But it could be written with a form using POST requests: > > > e form button > > action: [self increase]; > > text: '++' > > > As you can see, you don't have to deal with low level details, Iliad > > handle them for you. > > > A typical form in Iliad would look like: > > > e form build: [:form | > > form input > > action: [:string | self doSomethingWith: string]; > > value: 'default value'. > > form button > > text: 'Ok'] > > > HTH, > > Nico > > > signature.asc > > < 1KViewDownload |
I found a input#beSubmitOnChange message which appears to solve my
problem since, I guess, it executes the action blocks every time I type something. Is this the supposed solution to my problem or is there another preferred way? On Jun 4, 11:46 pm, ZuLuuuuuu <[hidden email]> wrote: > I have some trouble processing more than one form value. Say, I have > two fields like title and body for writing a blog entry, I created two > instance variables called title and body for the ILWidget (which > creates the form to post the entry). I try a code like below in the > contents message of the widget: > > e form > build: [:form | > "this is the title field" > form input > action: [:string | "here is a message to self to > assign the value to title instance variable"]; > value: 'default value'. > > "this is the body field" > form input > action: [:string | "here is a message to self to > assign the value to body instance variable"]; > value: 'default value'. > > form input > type: 'submit']; > > onSubmitDo: ["here is the message to add the entry"]. > > It appears that the onSubmitDo: block is executed before field values > are assigned. How can I solve this problem? > > P.S. Sorry for asking too much -basic- questions :) > > Canol > > On Jun 3, 2:10 pm, ZuLuuuuuu <[hidden email]> wrote: > > > Very nice, thank you... > > > On Jun 3, 1:05 pm, Nicolas Petton <[hidden email]> wrote: > > > > Hi Canol, > > > > In Iliad, we only think in action blocks. > > > > For example, the counter (using GET requests) looks like: > > > > e a > > > action: [self increase]; > > > text: '++' > > > > But it could be written with a form using POST requests: > > > > e form button > > > action: [self increase]; > > > text: '++' > > > > As you can see, you don't have to deal with low level details, Iliad > > > handle them for you. > > > > A typical form in Iliad would look like: > > > > e form build: [:form | > > > form input > > > action: [:string | self doSomethingWith: string]; > > > value: 'default value'. > > > form button > > > text: 'Ok'] > > > > HTH, > > > Nico > > > > signature.asc > > > < 1KViewDownload |
In reply to this post by ZuLuuuuuu-2
2010/6/4 ZuLuuuuuu <[hidden email]> I have some trouble processing more than one form value. Say, I have You can associate actions to the submit buttons too: e form build: [:form | form input action: [:string | ...]. form textarea action: [:string | ...]. form ckeckbox action: [:boolean | ...]. form button "clicking on it will submit the form" action: [...] "this action block doesn''t take any parameter"] Button are submit buttons by default. You don't need to associate an action to send the form, like onSubmitDo: ... Actions will be executed in the creation order, ie, the input action first, then the textarea action ,then the checkbox action, and finally the button action. Cheers, Seb
|
Thanks, I've changed my code accordingly.
On Jun 6, 1:39 pm, sebastien audier <[hidden email]> wrote: > 2010/6/4 ZuLuuuuuu <[hidden email]> > > > > > I have some trouble processing more than one form value. Say, I have > > two fields like title and body for writing a blog entry, I created two > > instance variables called title and body for the ILWidget (which > > creates the form to post the entry). I try a code like below in the > > contents message of the widget: > > > e form > > build: [:form | > > "this is the title field" > > form input > > action: [:string | "here is a message to self to > > assign the value to title instance variable"]; > > value: 'default value'. > > > "this is the body field" > > form input > > action: [:string | "here is a message to self to > > assign the value to body instance variable"]; > > value: 'default value'. > > > form input > > type: 'submit']; > > > onSubmitDo: ["here is the message to add the entry"]. > > You can associate actions to the submit buttons too: > > e form build: [:form | > form input action: [:string | ...]. > form textarea action: [:string | ...]. > form ckeckbox action: [:boolean | ...]. > form button "clicking on it will submit the form" > action: [...] "this action block doesn''t take any parameter"] > > Button are submit buttons by default. You don't need to associate an action > to send the form, like onSubmitDo: ... > Actions will be executed in the creation order, ie, the input action first, > then the textarea action ,then the checkbox action, and finally the button > action. > > Cheers, > Seb > > > > > It appears that the onSubmitDo: block is executed before field values > > are assigned. How can I solve this problem? > > > P.S. Sorry for asking too much -basic- questions :) > > > Canol > > > On Jun 3, 2:10 pm, ZuLuuuuuu <[hidden email]> wrote: > > > Very nice, thank you... > > > > On Jun 3, 1:05 pm, Nicolas Petton <[hidden email]> wrote: > > > > > Hi Canol, > > > > > In Iliad, we only think in action blocks. > > > > > For example, the counter (using GET requests) looks like: > > > > > e a > > > > action: [self increase]; > > > > text: '++' > > > > > But it could be written with a form using POST requests: > > > > > e form button > > > > action: [self increase]; > > > > text: '++' > > > > > As you can see, you don't have to deal with low level details, Iliad > > > > handle them for you. > > > > > A typical form in Iliad would look like: > > > > > e form build: [:form | > > > > form input > > > > action: [:string | self doSomethingWith: string]; > > > > value: 'default value'. > > > > form button > > > > text: 'Ok'] > > > > > HTH, > > > > Nico > > > > > signature.asc > > > > < 1KViewDownload |
Free forum by Nabble | Edit this page |