Hi there. I have modified the content submit form so that when someone fills out the form, it creates the html within the page and adds in all of the meta information into the new article. You can see the form here: http://www.mytownrealestateagent.com/sign-up
Here is the form html:
And here is the js:
The beginning js refers to an external file while the rest pulls the info from the form to place into the value inserted into the db to create the article. The problem is with the images. I leave the image area blank and just add in the file folder where chronoforms adds the uploads. And then when I get the content submitted through my email, I get the whole image name I then copy and paste into the article. Is there an easier way to do this? How can my article grab the name of the image that Chronoforms creates? If I get the name via email, I should be able to grab it in this form but I am not sure how.
I know this was a lot, I wasn't sure how else to go about it but to show the whole code. I am not very good with this stuff. :-)
Here is the form html:
<div class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Real Estate Agents Sign Up!</h1></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_text"><span class="cf_text">Enter your zip code.</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Zip Code</label><input class="cf_inputbox required" maxlength="150" size="30" id="zip" name="zip" type="text" onblur="updateCityState(); chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_text"><span class="cf_text">Now press the tab key to skip to the next field. If your city appears, you're good! If it says "Not Available", try another city.</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">City</label><input class="cf_inputbox required" maxlength="150" size="30" id="city" name="city" type="text" readonly="readonly" onblur="chgHidden(this); chgtitle(this); chgmetadesc(this); chgmetakey(this); chgalias(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">State</label><input class="cf_inputbox required" maxlength="150" size="30" id="state" name="state" type="text" readonly="readonly" onblur="chgtitle(this); chgHidden(this); chgmetadesc(this); chgmetakey(this); chgalias(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_text"><span class="cf_text">If your city appeared, it is available! Now let's enter your information.</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">First Name</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_1" name="text_1" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Last Name</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="text_2" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Suffix</label><input class="cf_inputbox" maxlength="150" size="30" id="text_3" name="text_3" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Broker Name</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_4" name="text_4" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Address</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_5" name="text_5" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">City</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_49" name="text_49" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">State</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_50" name="text_50" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Zip</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_51" name="text_51" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Office Phone</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_6" name="text_6" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Cell</label><input class="cf_inputbox" maxlength="150" size="30" id="text_9" name="text_9" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Fax</label><input class="cf_inputbox" maxlength="150" size="30" id="text_8" name="text_8" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Email</label><input class="cf_inputbox required validate-email" maxlength="150" size="30" id="text_12" name="text_12" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_checkbox"><label class="cf_label">Do You Want Your Email Hidden</label><div class="float_left"><input value="Yes" class="radio validate-one-required" id="Yes" name="Yes" type="checkbox"><label for="Yes" class="check_label">Yes</label><br><input value=" No" class="radio" id="_No" name="_No" type="checkbox"><label for="_No" class="check_label"> No</label><br></div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Website</label><input class="cf_inputbox validate-url" maxlength="150" size="30" id="text_10" name="text_10" type="text" onblur="chgHidden(this);"></div><div class="clear"> </div><div class="form_item"><div class="form_element cf_text"><span class="cf_text">(Website must begin with http:// )</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_fileupload"><label class="cf_label">Photo</label><input class="cf_inputbox" size="20" id="file_13" name="file_13" type="file" onblur="chgHidden(this);"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_fileupload"><label class="cf_label">Broker Logo</label><input class="cf_inputbox" size="20" id="file_14" name="file_14" type="file"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_captcha"><label class="cf_label"></label><span>{imageverification}</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_button"><input value="Submit" name="undefined" type="submit"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_hidden"><input value="text" id="introtext" name="introtext" type="hidden"></div><div class="clear"> </div></div>
<div class="form_item"><div class="form_element cf_hidden"><input value="text" id="title" name="title" type="hidden"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_hidden"><input value="show_title=
link_titles=
show_intro=
show_section=
link_section=
show_category=
link_category=
show_vote=
show_author=
show_create_date=
show_modify_date=
show_pdf_icon=
show_print_icon=
show_email_icon=
language=en-GB
keyref=
readmore=" id="attribs" name="attribs" type="hidden"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_hidden"><input value="robots=
author=rebecca" id="metadata" name="metadata" type="hidden"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_hidden"><input value="text" id="metadesc" name="metadesc" type="hidden"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_hidden"><input value="text" id="alias" name="alias" type="hidden"></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_hidden"><input value="text" id="metakey" name="metakey" type="hidden"></div><div class="clear"> </div></div>
And here is the js:
var url = "/test/getCityState.php?param="; // The server-side script
function handleHttpResponse() {
if (http.readyState == 4) {
if (http.responseText.indexOf('invalid') == -1) {
// Use the XML DOM to unpack the city and state data
var xmlDocument = http.responseXML;
var city = xmlDocument.getElementsByTagName('city').item(0).firstChild.data;
var state = xmlDocument.getElementsByTagName('state').item(0).firstChild.data;
document.getElementById('city').value = city;
document.getElementById('state').value = state;
isWorking = false;
}
}
}
var isWorking = false;
function updateCityState() {
if (!isWorking && http) {
var zipValue = document.getElementById("zip").value;
http.open("GET", url + escape(zipValue), true);
http.onreadystatechange = handleHttpResponse;
isWorking = true;
http.send(null);
}
}
function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
xmlhttp.overrideMimeType("text/xml");
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
function chgHidden() {
var introtext = document.getElementById('introtext');
introtext.value = '<h1>The TOP '+
document.getElementById('city').value+
', '+
document.getElementById('state').value+
' Real Estate Agent Is:</h1><p> </p><table border="0" width="600" style="background-image: url(\'images/atable.png\'); background-repeat: no-repeat; height: 350px"><tbody><tr style="height: 50px"> <td width="75"> </td><td width="125"> </td><td width="200"> </td></tr><tr><td> </td><td valign="top" style="width: 15%"><p><strong>Name:</strong></p><p><strong>Broker:</strong></p><p><strong>Address:</strong></p><p> </p><p><strong>Office:</strong></p><p><strong>Fax:</strong></p><p><strong>Cell:</strong></p><p><strong>Email:</strong> </p><p><strong>Website:</strong></p></td><td valign="top"><p> '+
document.getElementById('text_1').value+
' '+
document.getElementById('text_2').value+
' '+
document.getElementById('text_3').value+
'</p><p>'+
document.getElementById('text_4').value+
'</p><p>'+
document.getElementById('text_5').value+
'</p><p>'+
document.getElementById('text_49').value+
', '+
document.getElementById('text_50').value+
' '+
document.getElementById('text_51').value+
'</p><p>'+
document.getElementById('text_6').value+
'</p><p>'+
document.getElementById('text_8').value+
'</p><p>'+
document.getElementById('text_9').value+
'</p><p><a href="mailto:'+
document.getElementById('text_12').value+
'">'+
document.getElementById('text_12').value+
'</a> '+
'</p><p><a href="'+
document.getElementById('text_10').value+
'" rel="nofollow">'+
document.getElementById('city').value+
' '+
document.getElementById('state').value+
' Real Estate</a></p></td><td valign="top"> <img src="components/com_chronocontact/upload/" border="0" alt="'+
document.getElementById('text_1').value+
' '+
document.getElementById('text_2').value+
'" title="'+
document.getElementById('text_1').value+
' '+
document.getElementById('text_2').value+
'" /></td></tr></tbody></table><p><p><center><img src="components/com_chronocontact/upload/" border="0" alt="'+
document.getElementById('text_4').value+
'" title="'+
document.getElementById('text_4').value+
'" /></center><p>';
}
function chgtitle() {
var title = document.getElementById('title');
title.value = 'The TOP '+
document.getElementById('city').value+
' '+
document.getElementById('state').value+
' Real Estate Agent';
}
function chgmetadesc() {
var metadesc = document.getElementById('metadesc');
metadesc.value = 'Find out who the top '+
document.getElementById('city').value+
' '+
document.getElementById('state').value+
' Real Estate Agent is and find out who the other top agents are in cities across '+
document.getElementById('state').value+
' and across the US.';
}
function chgmetakey() {
var metakey = document.getElementById('metakey');
metakey.value = 'top, best, real, estate, agent, who, is, '+
document.getElementById('city').value+
', '+
document.getElementById('state').value;
}
function chgalias() {
var alias = document.getElementById('alias');
alias.value = 'top-'+
document.getElementById('city').value+
'-'+
document.getElementById('state').value+
'-real-estate-agent';
}
The beginning js refers to an external file while the rest pulls the info from the form to place into the value inserted into the db to create the article. The problem is with the images. I leave the image area blank and just add in the file folder where chronoforms adds the uploads. And then when I get the content submitted through my email, I get the whole image name I then copy and paste into the article. Is there an easier way to do this? How can my article grab the name of the image that Chronoforms creates? If I get the name via email, I should be able to grab it in this form but I am not sure how.
I know this was a lot, I wasn't sure how else to go about it but to show the whole code. I am not very good with this stuff. :-)