baseportal
Start

baseportal message board

Welcome to the baseportal message board...

Please read the FAQ.

 
 Selected message: To the list 
    Message from Kelly on 9/18 2003, 05:05 +00:00
    EMail: theonering@thegateroom.com

    I can't help you but maybe you can help me


      Still messing with the "mod" using a form. I have a form to input savings account balances (and other balances) from a charitable group that I'm in. These balances obviously change and I want one person to edit the form data, enter submit, have the info transfer to a baseportal template, and modify the entry in the database. Should be simple, right? Very much like your example with the "mod" code and "availability" but instead of "1" or "0", I want to change from the current value in the database to the form input value.

      I'm attaching my code below. Please look. Maybe I'm making a simple mistake (I've tried a hundred permutations already). Oh, my German "error" message translates as "Entry changed..." but nothing gets modify in the database.

      Baseportal Database fields: $Category == InitSav, $Value == "output from form" as a variable name??

      HTML page
      ---------

      <form name="budget" action="/baseportal/xagc_lj/budget" method="post" enctype="multipart/form-data">
      <input type="hidden" name="cmd=" value="mod">
      <input type="hidden" name="htx=" value="/xagc_lj/budget">

      <TABLE WIDTH="60%" ALIGN="right" CELLSPACING="0" CELLPADDING="3" BORDER="0">
      <TR>
      <TD><i>Savings</i></TD>
      <TD><Input type="text" size="10" maxlength="10" name="InitSav:="></TD>

      Template Baseportal
      -------------------

      <do action=input>

      <body>

      <perl>
      mod "Category==!InitSav", ["Value", "InitSav"], "budget"; <==if I put a value in here for "InitSav" it works fine but I want the value passed from the form
      </perl>
      <loop code=perl>
      out "Type: ",$Category, "<br>";
      out "Value: ",$Value, "<br><p>";
      $Value=$Value+$_loop{"Value"};
      </loop>

    Your reply:

    Name: EMail: WWW:
    Subject:
    Text:
    Timezone:

    Post a new message


 All messages from this thread: To the list 
    Message from merryn on 9/10 2003, 23:03 +10:00
    EMail: merrynhome@bigpond.com

    adding a modify link to update an db item from the web page


      I have read and re-read and re-read again all your documentation, scrolled through your message board and read several introductions to perl documents.... BUT I can't find an answer or solution to my probem. What I can't work out is how to create a link (just like your Modify and Delete links on the baseportal Database Content page) from my own baseportal webpage in order to show than an item has been "reserved" or taken.
      The database is really simple - only two fields: "item" [a text field with the product name] and "availability" [a numerical field with the values 0=available and 1=taken].

      I want to create either a button or a hyperlink (like your Modify | Delete options) to do this.
      When I try using a form and a button I use the command:

      <perl>
      mod "item==!X", ["availability", "1"], "MyDB";
      </perl>
      which works but it changes the availability of ALL items to be "taken" (ie. from "0" to "1").

      I also want to confirm (like your delete option does) if the user really wants to modify the item.

      So what I need to do is, IF the user confirms that they do really want to take the item, THEN do the ...

      mod "item==!X", ["availability", "1"], "MyDB";
      but I can't work out how to ONLY run the perl script only IF they confirm the modify/submit. (Can you return a value from a form button to a perl script??)

      As an alternative I looked at your code to try and understand how you did the Modify | Delete but I can't work out how to use the right perl commands in my own anchor tag.

      Am trying something like...

      <perl>
      out <a href="/baseportal/MyDB/main&cmd=do_mod&item=X&availability=~s/0/0/" onclick="return confirm (\'Are you sure you want to take this item\')">Modify</a>';
      </perl>
      but am now getting error messages....

      Am a bit of a pearl and baseportal novice but was pretty impressed with how well I was doing up to now. This is all I have to do to get it working!!

      I've tried everything I can think of and can't find any other examples like what I want to do.

      Any help would be GREATLY appreciated...
      Thanks

     Post a reply

    Message from Kelly on 9/18 2003, 05:05 +00:00
    EMail: theonering@thegateroom.com

    I can't help you but maybe you can help me


      Still messing with the "mod" using a form. I have a form to input savings account balances (and other balances) from a charitable group that I'm in. These balances obviously change and I want one person to edit the form data, enter submit, have the info transfer to a baseportal template, and modify the entry in the database. Should be simple, right? Very much like your example with the "mod" code and "availability" but instead of "1" or "0", I want to change from the current value in the database to the form input value.

      I'm attaching my code below. Please look. Maybe I'm making a simple mistake (I've tried a hundred permutations already). Oh, my German "error" message translates as "Entry changed..." but nothing gets modify in the database.

      Baseportal Database fields: $Category == InitSav, $Value == "output from form" as a variable name??

      HTML page
      ---------

      <form name="budget" action="/baseportal/xagc_lj/budget" method="post" enctype="multipart/form-data">
      <input type="hidden" name="cmd=" value="mod">
      <input type="hidden" name="htx=" value="/xagc_lj/budget">

      <TABLE WIDTH="60%" ALIGN="right" CELLSPACING="0" CELLPADDING="3" BORDER="0">
      <TR>
      <TD><i>Savings</i></TD>
      <TD><Input type="text" size="10" maxlength="10" name="InitSav:="></TD>

      Template Baseportal
      -------------------

      <do action=input>

      <body>

      <perl>
      mod "Category==!InitSav", ["Value", "InitSav"], "budget"; <==if I put a value in here for "InitSav" it works fine but I want the value passed from the form
      </perl>
      <loop code=perl>
      out "Type: ",$Category, "<br>";
      out "Value: ",$Value, "<br><p>";
      $Value=$Value+$_loop{"Value"};
      </loop>

     Post a reply


    Message from John on 10/2 2003, 13:43 +00:00
    EMail: darkshadow@x-fleet.net

    Re: adding a modify link to update an db item from the web page


      if i'm correct, your still trying to modify a database from a form as in your last thread posted. I'm not sure if you figured it out yet or not, but i had the same problem and finally figured it out. I used 2 different files, the form...and the perl script to send the forms to. Lets assume the database is called "names" Here is the form....

      <form action="/baseportal/userfolder/modify" method="post" enctype="multipart/form-data">
      <input type="hidden"name="cmd="value="mod">
      <input type="hidden"name="htx=" value="/your folder/modify">

      <input type="text" name="field1:=" size="12">
      <p align="left"><input type="submit" value="Send" name="B1"</p>
      </form>

      Then you would create another file, in this case called 'modify' and add this code to it...

      <perl>
      mod "name==john doe", ["field1", $field1], "databasename";
      </perl>
      <meta http-equiv="refresh" content="0; url=http://www.redirectwhendone.com">

      the mod command syntax is:

      mod "searchthisfield==forthisdatarecord",["field2modify", $formvariable], "database2modify"

      the next line is just a redirect method to take your viewers after they modify the page. I hope this helps, i added my email in case you still have problems. It took me a few days to figure out, but it works for me.

     Post a reply

    Message from Kelly on 10/3 2003, 06:08 +00:00
    EMail: theonering@thegateroom.com

    Re: adding a modify link to update an db item from the web page


      John,

      Thanks for spending time to explain how to make it work. I'd given up for now to focus on searching and linking databases. I've been delaying the whole "modify" thing as long as possible :)

      I'll give your method a try tomorrow.

      Kelly
     Post a reply


 Messages from 3300 to 3450: To the input form 
<< Newest messages | < Newer messages | To the input form | Older messages > | Oldest messages >>


Back to the homepage

© baseportal.com. All rights reserved. Terms of use



baseportal.com