ID:138372
 
var/page = ""
page += slSetFormButtonVal("button1","Inventory",null,/proc/ inventorypage(src))
var/formtext = slOutputForm(page)

I find that if I have inventorypage the code runs OK (apart from not sending the src!), but if I have inventorypage(src) then dreamseeker errors and dies when I click the button (no errors or warnings during compilation).

I can see a few work arounds (e.g. use a link maybe), but is there a way to get this working with buttons? I may have asked about this before, so sorry if I'm getting a bit senile.
On 9/28/00 2:40 am Al wrote:

I find that if I have inventorypage the code runs OK (apart from not sending the src!), but if I have inventorypage(src) then dreamseeker errors and dies when I click the button (no errors or warnings during compilation).

Eek! The syntax is wrong (you are only allowed to send proc names, like /proc/inventorypage), but it shouldn't crash. I'll look into that bug.

The button type is meant simply to call some procs _before_ the entire form gets submitted. I believe that you are correct in that you can't pass other data cleanly to it. For the case of 'src', though, you could probably get this to work by just using the same src value inside the called proc, since it is a global var. However, that is a bit risky since an intermediate call could change it.

The good news is that for the most part you can accomplish your task by making a form with a bunch of slSetFormVal() calls (for you data) and then creating a button with slSetFormSubmitVal(). You can then extract your data (in your case, 'src') with slGetVal(). My syntax may be a bit off but it's late here and I haven't looked at this in a while. I believe that the submitLink example shows a form that sets some values and submits everything with a button. You can rename this button accordingly. If you need multiple buttons you can probably just make multiple forms. Hopefully that will work.

Incidentally, Dan has written a pretty nifty upgrade of submitLink that uses a whole bunch of the newer language features to get around the hacks in the original version. It also has a cleaner notation and can be adapted for use on the web! You'll see that soon.

Good to have you back!

(Now I must get back to attempting to release 252 on this, the tenth night of delaying or something .. it's not looking too good!)