This project has moved. For the latest updates, please go here.

Adding another field at contact page

Nov 15, 2010 at 8:45 AM

I am a newbie in asp.net and I need to add another text field in the contact page and the text is passed through the url

For Ex: www.sitename.com/contact-us/?product enquiry

I need to get the "product enquiry" text to the new field.

Also the graffiti extras doesnt work on v1.3

Anyone please

Binu

Coordinator
Nov 16, 2010 at 5:12 AM

Well, the contact form is stored as a view file that you can edit by going to this location on your site:

/graffiti-admin/site-options/utilities/FileBrowser.aspx?path=__utility\forms&f=contact.view

You can add your form field there, but to actually get it sent to you, you're going to need to modify ajax.cs to include that field in the message generated (in the "newContactMessage" case). Ideally, this function would just read the entire form post data and include it on the message, but it doesn't do that right now.

The easiest way to handle auto-population from the querystring is to use javascript/jQuery to read it in and fill in the text box for you.

 

As for Graffiti Extras, we're going to need more details. What specifically doesn't work? That project hasn't been touched since well before Graffiti went open source, and I don't think the developer who created it even works for Telligent anymore (and he hasn't been logged in to codeplex in quite some time either). I think it would be good to bring that project "into the fold" and get it up and running, but we'd need to get in touch with Keyvan to see if he wants to make updates and/or add other people as contributors to the project. Otherwise, anyone can submit a patch to the project to fix the issues and leave it at that, but I'd rather see it addressed more fully.

Coordinator
Nov 17, 2010 at 2:44 PM

Graffiti Extras will work, at least the last time I tried it a few months ago. But you have to get the source of Graffiti Extras and recompile it vs. the new Graffiti dlls. That said, I didn't try every one of the tools in Graffiti Extras so there may be some that do not work.

Coordinator
Nov 18, 2010 at 5:29 AM

I once ran into the same need with the contact form, wanting to add additional fields so that I could have people RSVP for an event. I was able to make it work by setting the names of multiple form fields to name="comment" so that the contents of those fields would be concatenated into one value in the subsequent notification email and stored comment. That way I didnt have to modify Graffiti, but its also not an ideal solution, and might not pass html validation if that matters.

As for collecting the value from the url, besides jQuery, you could use a chalk extention like this

public string QueryString(string Key)
{
   return HttpContext.Current.Request[Key];
}

I use that so often, I'd like to see it added to the core.

Coordinator
Nov 18, 2010 at 7:56 PM

just added $macros.QueryString(string Key) in the last change set

Nov 22, 2010 at 11:14 AM

Hi

Thanks friends, i made it by adding a textbox with same name with another text box and i can now receive the additional filed data.

For getting the value from url i use a jquery

<script type="text/javascript">
var id = unescape(location.search.substr(1));
if (id) { document.contact_form.subject.value=id; }
</script>