Author Topic: csvUpdate Templates  (Read 7404 times)

0 Members and 1 Guest are viewing this topic.

Offline dmachine

  • Newbie
  • *
  • Posts: 2
csvUpdate Templates
« on: November 25, 2006, 03:20:44 PM »
I there any way to use my Input (csvWrite) template for csvUpdate? I still need the password protection but I would like my Users to see the same form they input from? I've surfed the Forum Archives and haven't found a good answer. Thanks.

Offline EZ

  • Hero Member
  • *****
  • Posts: 1081
    • Babelnotes.be
Re: csvUpdate Templates
« Reply #1 on: November 26, 2006, 05:38:08 AM »
Some people here do so indeed.  I hope they can tackle this one.

Offline Jason

  • Administrator
  • Hero Member
  • *****
  • Posts: 1018
    • slipdex
Re: csvUpdate Templates
« Reply #2 on: November 27, 2006, 10:19:54 AM »
dmachine,

You sure can use the same form.... 

What you want to do is copy your original form, then set the value of each of your fields with the coresponding field name like this:
<input type=text value=[[field1]]>

The in your form tag:

   <form method="POST" action="/cgi-bin/csvupdate.pl">

Then right below your form tag add these hidden values:

         <input type="hidden" name="ID" value="[[ID]]">
         <input type="hidden" name="action" value="save">

I can't take all the credit for this one because Adalby got this working the first time I think, but I have adapted it so much, I believe this is the straightest version you could find.  Let me know if you need anymore help!

Jason
Founder of www.slipdex.com

Rob Clermont

  • Guest
Re: csvUpdate Templates
« Reply #3 on: November 27, 2006, 08:46:14 PM »
Jason,
I'm curious, when using the customized update form are you still able to restrict access to the record by a username and password.

Rob C.

Offline Jason

  • Administrator
  • Hero Member
  • *****
  • Posts: 1018
    • slipdex
Re: csvUpdate Templates
« Reply #4 on: November 28, 2006, 01:36:36 PM »
Rob,

Two fold issue when you try that.  Yes you can restrict access by using a two form system.  The first form is the login, ID followed by their supplied password, then you forward them to the custom update form you have created.  I have done it on one project, but it was a while ago.  UHG, it's gonna bug me now, but I will try to dig it out so I can post the basic code on here.  As I recall it wasn't hard to do if you know how to abuse the scripts, which as a matter of fact Adalby is WAY better than I am at it!  If I find it, I will post it for you.  In the middle of like 5 projects, but I will come across it!

Jason
Founder of www.slipdex.com

Rob Clermont

  • Guest
Re: csvUpdate Templates
« Reply #5 on: November 28, 2006, 07:56:19 PM »
Jason,
Thanks for the quick reply.  My question was more out of curiosity than anything else.  I'm Intrigued by the idea of being able to use a modified Update form that could be accessible via the same user name and password that a member chooses in CSVwrite.  Any other info that you have would be greatly appreciated, however there is absolutely no rush.

Thanks,
Rob C. 

Offline dmachine

  • Newbie
  • *
  • Posts: 2
Re: csvUpdate Templates
« Reply #6 on: December 07, 2006, 08:11:42 AM »
Jason.
Thanks for the Update Mods. Will be looking for the user login code.
dmachine.

Offline mvakbar

  • Full Member
  • ***
  • Posts: 70
Re: csvUpdate Templates
« Reply #7 on: December 12, 2006, 04:25:22 PM »
Man I am glad I saw this posting before I ask the same questions.  Here is another question from a rookie.

Using the CSVUpdate, I want my administrator see or update fields that would otherwise be invisible or uneditable to the original poster.  How can I do that?

Offline EZ

  • Hero Member
  • *****
  • Posts: 1081
    • Babelnotes.be
Re: csvUpdate Templates
« Reply #8 on: December 12, 2006, 06:33:29 PM »
Man I am glad I saw this posting before I ask the same questions.  Here is another question from a rookie.

Using the CSVUpdate, I want my administrator see or update fields that would otherwise be invisible or uneditable to the original poster.  How can I do that?

Do not include those fields on your form (or at least the visible part).

Offline mvakbar

  • Full Member
  • ***
  • Posts: 70
Re: csvUpdate Templates
« Reply #9 on: December 13, 2006, 12:10:48 AM »
EZ, Jason,

There was a suggestion that in order to use our CSVWrite form with CSVUpdate we can

"copy your original form, then set the value of each of your fields with the coresponding field name like this: <input type=text value=[[field1]]>"

What do I do for my Selects.  for example I have a field like this:

<select style="WIDTH: 384px" size="1" name="sourceEstimate">
<option value="    " />
<option value="Appraisal">Appraisal</option>
<option value="Estimate">Estimate</option>
<option value="Sales Price">Sales Price</option></select>

Later on when we come to update we might still want to be able to use a value from the pull down.

Am I correct that in this case I just copy the filed to my update form and leave it as is?

Offline Jason

  • Administrator
  • Hero Member
  • *****
  • Posts: 1018
    • slipdex
Re: csvUpdate Templates
« Reply #10 on: December 13, 2006, 08:48:46 AM »
Adalby had a good idea on this one....

In your update form, set your select menu like this:

<select name=blah>
<option value=[[field]]>[[field]]</option>
<option>next</option>
<option>nextone</option>
</select>

That way your record value is displayed as the selected, or top value, or specifically add the selected tag, and you still have a drop down menu in your form.  Simple and handy.  In the tips and tricks section there is also discussing this using javascript, but I don't suggest it unless you are familiar.  This is a simple way to do it!  Thanks Adalby for the good catch!

Jason
Founder of www.slipdex.com

Offline mvakbar

  • Full Member
  • ***
  • Posts: 70
Re: csvUpdate Templates
« Reply #11 on: December 13, 2006, 03:49:28 PM »
Jason, Adalby,

Thank you for the idea.  I will try to see if I can test this tonight after I am done with my "day job". 

By the way my current input form (the one I use with CSVWrite) has a whole bunch of javascript I use to hide and show different sections of the form based on conditions.  Would there be any reason they wouldn't work when I invoke the form (the update copy) by CSVUpdate?

Offline EZ

  • Hero Member
  • *****
  • Posts: 1081
    • Babelnotes.be
Re: csvUpdate Templates
« Reply #12 on: December 13, 2006, 04:15:24 PM »
Javascripts on a csvread/csvsearch template should not be a problem.

Offline mvakbar

  • Full Member
  • ***
  • Posts: 70
Re: csvUpdate Templates
« Reply #13 on: December 14, 2006, 12:17:34 AM »
I have renamed my CSVWrite input form to updateTemplate.htm.  I have updated my source code for CSVUpdate script as:

my $template        = '../public/updateTemplate.htm';

In my code I have added:

<input type=text value=[[fieldname]]>

Am I correct that the above is correct and not the following syntax:

<input type=text value=[[fieldname]]/>

These are the other changes I have made to my code:

<FORM method="POST" action="/cgi-bin/csvupdate.pl">
<input type="hidden" name="ID" value="[[ID]]">
<input type="hidden" name="action" value="save">


I have changed just a few of my fileds to the following format:

<input type="text" name="borrowerLastName" value=[[borrowerLastName]]>

I am opening my record from a link:

http://syntony-fs.com.sitepreview.mysuperpageshosting.com/cgi-bin/csvupdate.pl?ID=1000002

I am putting my <Template> tag right under </head> and I am putting my </Template> tag like this:

</body>
</template>
</html>

Now if I add the <Template> </Template> to my code, my file seems to be competely ignored and my record is opened in a format similar to the default template provided by EZ.

If I remove the Template tags I just get a blank screen which means the script must be reading my form but doesn't like it.

Any idea why I am still not opening my record with my revised input file?

Offline EZ

  • Hero Member
  • *****
  • Posts: 1081
    • Babelnotes.be
Re: csvUpdate Templates
« Reply #14 on: December 14, 2006, 02:45:32 AM »
The idea is to call csvread/csvsearch to generate your input form, not csvupdate.