Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Where to appoint, what a button should do?

edited April 2007 in Vanilla 1.0 Help
Hey

I'm actually developping an own extension, which appears in a seperate tab.

I've create a few of textfields an a Button, but how can I make clear, whta should be done, if the user clicks the button?

--Richard

Comments

  • Well, if your passing the information back to the server, then you should use something like this to get the data:$variable = GetIncomingString('FormFieldName', 'Default value to use if nothing was passed from the form');

    If you want to do something in the user's browser, that would be something like this:<input type="button" onclick="alert('Boo!');return false">Click me!
  • "GetIncomingString" should be "ForceIncomingString" :)
  • edited April 2007
    mmh, thx you two...

    I want to pass them back...

    so I need ForceIncommingString?

    My Render-functions look like that:
    echo "<input type='text' name='Name' value='' class='SmallInput' /><br />"; echo "<input type='submit' name='btnSave' value='Speichern' class='Button SubmitButton' />"; $var= ForceIncomingString('Name', 'baaaaad'); echo $var;

    but I get always the "baaaaad" string aus output... even if I click the button... whats going on, if I click it?

    Will the page be reloaded?

    Where I have to catch the "IncommingString"?
  • *bump* no idea?
  • This should be a good place to start: PHP Forms

    Keep in mind when you are learning about PHP that Vanilla's framework tries to make the work easier for you in some places, so instead of having to worry about $_GET['name'] or $_POST['name'], which can return escaped or unescaped data depending on your security settings, you have ForceIncomingString('name', ''). You can learn a bit more how it works by looking at library/framework/Functions.php, where it is defined, around line 340.

    Probably the best way to learn would be to find an extension that does something similar--off the top of my head, extensions that I know use forms and save data are Announcement, ToDo list, Signatures, Extended Application Form, Add Comments, and Nuggets (these last two might be a bit hard to understand at first...)

    Good luck!
  • thanks... I'll take a look...previous extensions I looked at did'nt help...
This discussion has been closed.