Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How To: Add Fields to Modify Form

Quote Reply
How To: Add Fields to Modify Form
I am trying add a few fields to my Modify.cgi, Modify.html form for 2.0.4.
Can anyone tell me where <%db_cgi_url%> is defined?
Easy ways to do it? I need to pass the original information
just as the default template does.

Thanks in advance.

Quote Reply
Re: How To: Add Fields to Modify Form In reply to
<%db_cgi_url%> is the url to your user cgi-bin you can set in the setup tool in your admin.

the results will be stored in Links::ConfigData.pm

<%db_cgi_url%> is a global tag that comes in nearly all your templates.



Quote Reply
Re: How To: Add Fields to Modify Form In reply to
in the default templates for 2.04 the fields are included via
<%include form.txt%>

so you just hack form.txt, and if you want the values included, make a new form.txt called newform.txt, and make the <input value="<%fieldname%"> type=text> .

[the html designer probably cut them out...not a good idea having the same form.txt for the add and modify]

Quote Reply
Re: How To: Add Fields to Modify Form In reply to
Thank you,
I guess I was on the wrong track.
I'm trying to figure where it is defined which fields are passed to the user through the modify.html template.

I think I may be making this more difficult than it is, but I'm totally lost after 2 days of trying.

Quote Reply
Re: How To: Add Fields to Modify Form In reply to
Andy,
Thank you..........!!!!!!!!!!!!!!!

Quote Reply
Re: How To: Add Fields to Modify Form In reply to
In Reply To:
[the html designer probably cut them out...not a good idea having the same form.txt for the add and modify]
Actually, that was the purpose of form.txt, to be used in the add and modify areas, and across all the forms. You _can_ change them, but most often, fields used in the add form are the same ones a user can modify on the modify form -- think about it :)

Add your "extra" fields in the template, or, go ahead and make a new add_form.txt and mod_form.txt, tetc. Not a bad idea, and once you start using <%loop%> <G> the forms keep multiplying :)

You can also do things such as make one form.txt, that can handle whether it's an add or a modify, and which knows if a form is allowed to be changed, or not, or more. <%if%> tags are very useful for this.

For instance, in an add form, there would be no "hits" or "rating", so if you used:

Code:
<%if Hits%>
<t r> <T d> Hits: </ t d >
<T d><%Hits%> </ t d >
</ t r>
<%endif%>
That row will only show in the modify form.

Make sense? You can also use complicated <%if%> nestings to add parameters to img tags and input fields, and more.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: How To: Add Fields to Modify Form In reply to
In Reply To:
Actually, that was the purpose of form.txt, to be used in the add and modify areas, and across all the forms. You _can_ change them, but most often, fields used in the add form are the same ones a user can modify on the modify form -- think about it :)
I realise that, but if you use the same form.txt as supplied in the default templates then that means that the user has to cut and paste all the data into the modify form, which is a waste of time for the user and can generate errors. Much easier just to have the data included in the modify form when the user sees it. That's why i think that it's a bad idea, and that's where clueless' problem lies.

Of course, you can use if and set tags to include the <%data%> tags in the forms, which is better than having two different form.txt files.