Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How do I add a form field?

(Page 1 of 3)
> >
Quote Reply
How do I add a form field?
I am a new Gossamer Links customer, and I should tell you off the bat that I am not a coder or programmer so if you have an answer to my questions, please be very literal. I'm not a dummy and I can find my way around the different areas in the admin panel if you just tell me where to go or look.

My first question is I need to add a field for phone number to the form that users fill out to submit their link. Can someone direct me on where to go to do this and maybe a little guidance?

Second question is on my link form there is a field that says "Title." I need it so say "Company Name" instead so that the user knows exactly what I want there. Same thing with "Contact Name." I need to change that to "Full Name." Can you tell me where to go to change this and how?

Thanks very much!!!
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
My first question is I need to add a field for phone number to the form that users fill out to submit their link. Can someone direct me on where to go to do this and maybe a little guidance?[/quote]

In your admin, goto Database -> Editor -> Links -> Properties (scroll down) -> Add Column

You can click 'click here' for information on what each column means. You might also want to add something like ^\d{3}\d{3}\d{4} in your redex to only allow phone numbers.

Under Build -> User Templates -> add.html you might want to add a text box or so for your new column type.

In Reply To:


Second question is on my link form there is a field that says "Title." I need it so say "Company Name" instead so that the user knows exactly what I want there. Same thing with "Contact Name." I need to change that to "Full Name." Can you tell me where to go to change this and how?[/quote]

Once again, edit the add.html template.

Good luck,

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
Thanks!

You lost me after this part: In your admin, goto Database -> Editor -> Links -> Properties (scroll down) -> Add Column

(and don't ask me to read that "click here" stuff. I already did that and if I understood what all the Greek meant, I wouldn't be here, LOL).

So, I'm at the part to "Add Column" and I assume under Column Name I'm going to put "Phone."

I have no idea what I should select for Column Type, much less what to put in any of the other boxes.

As far as the rest of your instructions, again, I am not a programmer or coder. I have no idea what you are talking about. I need very simple, step by step instructions, if you could provide that, I'd be very grateful.
Quote Reply
Re: [therelief] How do I add a form field? In reply to
The 'column name' is what the field is saved as in the db. You probably want that to be 'Phone' or 'phone'. Because it's a phone number, the field type will need to be a number type. INT (short for integer) will work. The form regex (short for regular expressions) is a validate field. It will limit the kind of data a user can add to the field.

example:

^\d{3}\d{3}\d{4}

^ - means at the begining of the input

\d - means search for a number

{3} - means 3 numbers {4} for four

So it only allows that type of input from a user, or it will return an error. The other fields are more for advanced users and you can leave blank for now.

This just creates the field for the phone number to be stored. You have to add a phone number input to the add.html template: <input type=text name="the name of your field" value=default value> etc.

Hope this helps,

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
How does that work with international numbers? Our directory is for member who are all over the world so a number in the US and Canada would be listed at xxx-xxx-xxxx, but a number somewhere else, they often use a different format. Will what you just explained make it hard for them to enter their number?

Obviously, I only want numbers used in the phone number field, but I don't want to be too picky about the format so as to avoid difficulty for our members.
Quote Reply
Re: [therelief] How do I add a form field? In reply to
On this:

This just creates the field for the phone number to be stored. You have to add a phone number input to the add.html template: <input type=text name="the name of your field" value=default value> etc.

I'm just really, really lost. I don't know where this is supposed to go. I know where to find the template, but I don't know where that code is supposed to go in there.

Here's the code from the add.html template:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/...ml1-transitional.dtd">
<html>
<head>
<title><%site_title%>: Add a Link</title>
<%include include_common_head.html%>
</head>
<body id="add">
<%include include_accessibility.html%>
<div id="wrapper">
<%include include_header.html%>
<%include include_contentheader.html%>
<div id="ocwrapper" class="clear">
<div id="icwrapper" class="clear">
<%include include_leftsidebar.html%>
<div id="contentwrapper" class="shadowleft">
<%include include_contentwrapper_top.html%>
<div class="shadowtop"><div class="shadowtopleft"></div><div class="shadowtopright"></div></div>
<div class="shadowright">
<div id="content">
<%include include_content_top.html%>
<div class="crumb"><%Links::Utils::format_title($main_title_loop, separator => $crumb_separator, no_escape_separator => $no_escape_crumb_separator, include_home => 1, link_type => 2)%></div>
<h2>Add a Link</h2>
<p>
Please completely fill out the form, and we'll add your link as soon as possible.
</p>
<form action="<%config.db_cgi_url%>/add.cgi" enctype="multipart/form-data" method="post">
<%include include_form.html%>
<div class="formsubmit">
<input type="submit" name="add" value="Add Link" class="submit" />
</div>
</form>
<%include include_content_bottom.html%>
</div>
</div>
<div class="shadowbottom"><div class="shadowbottomleft"></div><div class="shadowbottomright"></div></div>
<%include include_contentwrapper_bottom.html%>
</div>
<%include include_rightsidebar.html%>
</div>
</div>
<%include include_contentfooter.html%>
<%include include_footer.html%>
</div>
</body>
</html>
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
How does that work with international numbers? Our directory is for member who are all over the world so a number in the US and Canada would be listed at xxx-xxx-xxxx, but a number somewhere else, they often use a different format. Will what you just explained make it hard for them to enter their number?[/quote]

If that is the case, then just leave the redex form blank.

In Reply To:

This just creates the field for the phone number to be stored. You have to add a phone number input to the add.html template: <input type=text name="the name of your field" value=default value> etc.[/quote]

I'm sorry. Edit the 'include_form.html' template.

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
Okay, I'm still trying to understand how to add the Phone field.

Here's what I need to know:

Column Name: Phone
Column Type: ?
Column Index: ?
Column Size: ?
Column Values: ?
Not Null: yes or no (defaults to "no"; should I leave that?
Default: ?
Form Display: Phone (I'm assuming that's what I put
Form Type: ? (has TEXT showing as default)
Form Size: ?
Form Names: ?
Form Values: ?
Form Save Location: ?
File Save URL: ?
File Save Method: ? (has HASHED showing as default)
File Maximum Size: ?
Form Regex: ?
Search Weight: ?
Quote Reply
Re: [therelief] How do I add a form field? In reply to
Where I left it blank -- leave it blank

Column Name: Phone
Column Type: Text
Column Index:
Column Size:
Column Values:
Not Null: no
Default:
Form Display: Phone
Form Type: Text
Form Size:
Form Names:
Form Values:
Form Save Location:
File Save URL:
File Save Method: default
File Maximum Size:
Form Regex:
Search Weight: 1

Search Weight:
(this means do you want people to search by phone number? If you do add a number (1) if not leave blank.


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] How do I add a form field? In reply to
Thank you so much!!!

Now, back to the rest of it...now that I've added a column for Form, it's listed at the very bottom. Is there a way to make sure it displays on the actual form the users fill out so that it is in the order I prefer (e.g., Full Name, Email, Website, Phone...)?

Also, I guess I now have to update one of the templates, right? Which one is it (since a couple have been mentioned now)? And what do I change?
Quote Reply
Re: [therelief] How do I add a form field? In reply to
The template you are looking for is:

include_form.html

copy and paste one of the existing forms and change it to read

<%if phone%><%phone%><%endif%>


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] How do I add a form field? In reply to
Thank you again!

What about ID? I don't see anything in the column area for that?

Here's what I've changed so far (don't know what to do with "ID" so I changed it to "Phone." Is that okay?):

<div class="row clear">
<label for="Phone" class="name"> Phone:</label>
<div class="value">
<input type="text" id="Phone" name="Phone" value="<%if phone%><%phone%><%endif%>" class="text" />
</div>
</div>
Quote Reply
Re: [therelief] How do I add a form field? In reply to
One other thing, on Contact_Name--that's the one I changed to "Full Name"--it is autofilling with the user's login name. That is confusing to users because I want them to type in their Full Name. How can I get rid of that (and will it mess anything up for some reason)?
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
What about ID? I don't see anything in the column area for that?

Here's what I've changed so far (don't know what to do with "ID" so I changed it to "Phone." Is that okay?):

<div class="row clear">
<label for="Phone" class="name"> Phone:</label>
<div class="value">
<input type="text" id="Phone" name="Phone" value="<%if phone%><%phone%><%endif%>" class="text" />
</div>
</div>[/quote]

Don't worry about the id, it is there for the style sheets and advanced coding.

In Reply To:
One other thing, on Contact_Name--that's the one I changed to "Full Name"--it is autofilling with the user's login name. That is confusing to users because I want them to type in their Full Name. How can I get rid of that (and will it mess anything up for some reason)?[/quote]

I wouldn't change the actual Contact_Name field, just change the label for it since that is what the users see:

Code:

<label for="Contact_Name" class="name">Full Name:</label>


Hope this helps,

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
Okay, thanks! I guess I'll have to talk to Gossamer about that because people aren't putting in their full name because they see that the field is already filled in. That creates WAY too much for me having to email them and get their full name, etc.

Here's another thing I need to finish...Here's my directory page: http://www.virtualassistantnetworking.com/directory/

I'd like the orange nav bar to be the same width as all the rest. How do I fix that?
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
Okay, thanks! I guess I'll have to talk to Gossamer about that because people aren't putting in their full name because they see that the field is already filled in. That creates WAY too much for me having to email them and get their full name, etc.[/quote]

One way around this is for you to use javascript to take two fields (first name and last name) and submit them as one. You could then use the same script to make sure the field is required:

Code:

<script language="JavaScript">
function getFullName() {
document.form1.fullname.value = (document.form1.firstname.value + " " + document.form1.lastname.value);
}
function checkNames() {
if ((document.form1.first.value.length < 3) or (document.form1.first.value.length < 3)) {
window.alert("You must enter a first and last name!");
return true;
}
}
</script>


The getFullName function should be called to get the full name. The check names function requires that the user enter at least 3 chars of the first name and 3 chars of the last name. I don't have time to check this right now or call the functions... I can test it later, maybe someone here can fill the rest in:

In Reply To:

I'd like the orange nav bar to be the same width as all the rest. How do I fix that?[/quote]

What do you mean the same as the rest?

- Jonathan
Quote Reply
Re: [therelief] How do I add a form field? In reply to
One way around this is for you to use javascript to take two fields (first name and last name) and submit them as one. You could then use the same script to make sure the field is required:

I have absolutely no idea how to do that, nor do I think it's wise especially since I have no understanding of what I'm doing. I don't think for our purposes we need that kind of complexity. I just don't want the darn field auto-filling, plain and simple. It makes users think they don't have to correct it and type in their full name as requested. But I'll leave that issue for Gossamer since it seems to be very complicated and I have just been through a horrible ordeal with a hosting transfer during which they lost our original directory and which is why I'm having to put everything back in place now. I'm about ready to put a gun to my head, LOL.

But I digress...

If you go to my directory, you will see that the everything is in alignment on both sides--except for the orange nav bar which is does not go all the way to the right. I want it to be the same width as the rest of the site so that the orange extends to the right the same as the header and the directory area. I don't know how else to describe clearly. Do you see how the orange nav bar is shorter than everything else?
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
I have absolutely no idea how to do that, nor do I think it's wise especially since I have no understanding of what I'm doing. I don't think for our purposes we need that kind of complexity. I just don't want the darn field auto-filling, plain and simple. It makes users think they don't have to correct it and type in their full name as requested. But I'll leave that issue for Gossamer since it seems to be very complicated and I have just been through a horrible ordeal with a hosting transfer during which they lost our original directory and which is why I'm having to put everything back in place now. I'm about ready to put a gun to my head, LOL.[/quote]

The javascript was just an idea. You could always just add two new fields, first name, last name. You can view the properties of the Contact Name field and copy them as you create two new fields, first name, and last name: just like you did for the phone number. You will have to edit the Contact_Name not null field so that it is not required. If you want GT to help you out on this, good luck.

In Reply To:
If you go to my directory, you will see that the everything is in alignment on both sides--except for the orange nav bar which is does not go all the way to the right. I want it to be the same width as the rest of the site so that the orange extends to the right the same as the header and the directory area. I don't know how else to describe clearly. Do you see how the orange nav bar is shorter than everything else?[/quote]

That is because of your tables, which original templates pretty much don't use. If you move the login bar code to another cell or another place, you will see that the orange nav bar will go accross the screen. That is why it doesn't matter whether or not you have text-align = center on either the <div> or the <td>

BTW: you can creat these "in reply to" by highlighing the text and clicking the "RE:" button.

Hope this helps,

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
Um, I have no clue as to what you just said. I am not a coder so please don't assume that I know what these codes and stuff you refer to mean. I don't, so your conversation about those things might as well be in Greek or Cantonese, LOL.

"That is because of your tables, which original templates pretty much don't use. If you move the login bar code to another cell or another place, you will see that the orange nav bar will go accross the screen."

That won't work because then I'd be back to square one with it not being in alignment with my header and the directory. Putting it in the table was the only way I got it to line up. Do you have another idea?

Would it be possible to just tell me the actual steps to correct this? I can follow along if you do that.

Last edited by:

therelief: Sep 25, 2006, 12:18 PM
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
Um, I have no clue as to what you just said. I am not a coder so please don't assume that I know what these codes and stuff you refer to mean. I don't, so your conversation about those things might as well be in Greek or Cantonese, LOL.[/quote]

All you have to do is create two new fields, just like you did for the phone (if you prefere this method) for First Name and Last Name like so:

Quote:


Column Name: First_Name
Column Type: VARCHAR
Column Index: None
Column Size: 255
Column Values:
Not Null: Yes
Default:
Form Display: First Name
Form Type: Text
Form Size: 20
Form Names:
Form Values:
Form Save Location:
File Save URL:
File Save Method: default
File Maximum Size:
Form Regex:
Search Weight: 1


Do the EXACT same thing for last name. Remember you add a column under Database -> Editor -> Table -> Properties -> (scroll down) -> Add Column

Then edit your template "include_form.html" under Build->User Templates ... JUST LIKE YOU DID for the phone number adding two new fields: for first name and last name.

to be more specific... replace this:

Code:
<div class="row clear">
<label for="Contact_Name" class="name">Contact Name:</label>
<div class="value">
<input type="text" id="Contact_Name" name="Contact_Name" value="<%if Contact_Name%><%escape_html Contact_Name%><%endif%>" class="text" />
</div>
</div>


with this:

Code:

<div class="row clear">
<label for="First_Name" class="name">First Name:</label>
<div class="value">
<input type="text" id="First_Name" name="First_Name" value="<%if First_Name%><%escape_html First_Name%><%endif%>" class="text" />
</div>
</div>
<div class="row clear">
<label for="Last_Name" class="name">Last Name:</label>
<div class="value">
<input type="text" id="Last_Name" name="Last_Name" value="<%if Last_Name%><%escape_html Last_Name%><%endif%>" class="text" />
</div>
</div>


and that should store the first name, and last name as separate fields. Remember the not_null set to Yes is what requires the user to enter the field.

In Reply To:
That won't work because then I'd be back to square one with it not being in alignment with my header and the directory. Putting it in the table was the only way I got it to line up. Do you have another idea?[/quote]

I don't have time to go through the html right now, but I will get back to you on this...

Good luck with the first part,

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
Okay, I'm going to try that. Thank you!

First, just to be clear, this will replace the "Contact Name" field that autofills? That won't mess up any important coding or anything?
Quote Reply
Re: [therelief] How do I add a form field? In reply to
In Reply To:
First, just to be clear, this will replace the "Contact Name" field that autofills? That won't mess up any important coding or anything?[/quote]

Deleting "Contact Name" from the template (include_form.html) should not cause any problems. However, I would not recommend deleting the actual field value for it (from the column properties). It should just be used as a blank field that is not required (as the not null option says).

In Reply To:

Here's another thing I need to finish...Here's my directory page: http://www.virtualassistantnetworking.com/directory/

I'd like the orange nav bar to be the same width as all the rest. How do I fix that?[/quote]

After looking at it again, I believe you just need to make the margin longer. Try this:

Code:

ul.primarynav, ul.secondarynav {
margin-right: 200px;
}


You may have to change the 200 pixels around to get the right number. I also recommend you change the title of your page. It is still set to "Gossamer Links". You can change the value of <%site_title%> under Build->Template Globals.

Hope that helps,

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
Thanks!

On the nav bar margin, I got confused. Here's all the navigation from the CSS tempate. I found where ul.primarynav, ul.secondarynav are located, but they don't seem to have the margin-right code anywhere. Were you meaning that I should actually add it (I at first thought I was support to find the margin-right and then just change it to 200px)?

Here's the codes:

ul.primarynav, ul.secondarynav {
margin: 0px;
padding: 0px;
border-bottom: 1px solid #ffffff;
float: left;
list-style: none;
}
ul.primarynav {
width: 100%;
background: #ff6000;
}
ul.secondarynav {
width: 100%;
background: #ff6000;
}
ul.primarynav li, ul.secondarynav li {
float: left;
list-style: none;
}
ul.primarynav li {
border-right: 1px solid #ffffff;
}
ul.primarynav a {
margin-right: 1px;
padding: 7px 9px 7px 10px;
float: left;
color: #ffffff;
font-size: 11px;
text-decoration: none;
}
ul.primarynav a:visited {
color: #ffffff;
}
ul.primarynav a:hover {
color: #ffffff;
background: #9999cc;
}
ul.primarynav li.home {
border-right: 1px solid #ffffff;
background: #ff6000;
}
ul.primarynav li.home a {
margin-right: 0px;
}
ul.secondarynav li.first {
padding-left: 5px;
}
ul.secondarynav a {
margin-right: 1px;
padding: 4px 5px;
float: left;
color: #ffffff;
font-size: 10px;
text-decoration: none;
}
ul.secondarynav a:visited {
color: #ffffff;
}
ul.secondarynav a:hover {
color: #9999cc;
}
Quote Reply
Re: [therelief] How do I add a form field? In reply to
You should not have copied everything from luna_core.css into luna.css. Everything from luna_core.css is AUTOMATICALLY loaded into luna.css. All you have to do is add the code that you want to change...

Example: There is this code in luna_core.css

Code:

body {
margin: 0px;
padding: 0px;
color: #33332e;
background: #ffffff;
font: normal 11px tahoma, geneva, verdana, sans-serif;
text-align: center;
}


If you wanted to change the background of your page (since you can't edit luna_core.css), you simply add anywhere to the luna.css file:

Code:

body {

background: #000000;

}

and the background becomes black. All of the other code (padding, margin, etc) is STILL retained. I HIGHLY suggest you go back and only add changes to luna.css form parts of the code that you need. For now though, you can add the code I gave you at the bottom of the file so that it will override any other code since it is loaded last. I don't know if the code I gave you in the above forum will work.

I wish you Good Luck!

- Jonathan
Quote Reply
Re: [jdgamble] How do I add a form field? In reply to
"You should not have copied everything from luna_core.css into luna.css. Everything from luna_core.css is AUTOMATICALLY loaded into luna.css. All you have to do is add the code that you want to change... "


The problem I ran into, though, is that I don't know what all these codes are and it was only by trial and error that I got anything to look the way I wanted. Unfortunately, by the time that inefficient and time-wasting process was over, and then still needing to change other things, I had no idea what I had already copied over and what I didn't and so on. The only way I could figure out to make sure I wasn't pasting in something I already had in there was to simply put the whole CSS sheet into Luna and go from there.

From a customer perspective, I think that whole CSS process the way it is in there now could be very much improved upon. I love the software, but I think it could be made much more user friendly for novices/non-coders like me. At the least, perhaps made a bit more clear before the purchase is made (it's not exactly inexpensive) that a programmer or coder is necessary to actually get it customized and that the expense doesn't end with the purchase. If my organization had the money to hire someone, we would in a heartbeat because this has been very frustrating for me. Unfortunately, we don't so I'm sacrificing my sanity for the benefit of our members, LOL.

So that's why I had to do that. But I digress (again).
> >