HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Need Help Adding A Project Quote Form

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#59259 (In Topic #12900)
Avatar

Fan in action

How do I create a new form with custom fields, Captcha, etc?

I made a few searches in the Help Docs and Forums but have not come up with a definitive answer for creating a project quote form.

How do I add fields to the standard contact form? or

How do I create a New form, with custom fields?

Any help would be greatly appreciated… about to launch a site soon!:cool:

Thanks

David
Back to the top
 
Posted
Rating:
#59260
Avatar

Hi,

3 approaches come off the top of my head…

1) You can craft your own HTML, and submit to data/form_to_email.php, which smartly analyses what fields were POST'd and relays them to the staff email address.

2) You can direct them to add a catalogue entry (a bit messy, but allows some complex stuff).

3) Ditto to submit a survey.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#59261
Avatar

Fan in action

Submit Your Project Quote

Code

lt;formaction=quot;/rfq-send.phpquot;method=quot;postquot;enctype=quot;multipart/form-dataquot;name=quot;form1quot;id=quot;form1quot;onsubmit=quot;returnv.exec()quot;gt;lt;inputtype=quot;hiddenquot;name=quot;MAX_FILE_SIZEquot;value=quot;10000000quot;/gt;lt;h3gt;lt;aname=quot;reqquot;id=quot;reqquot;gt;lt;/agt;RequestforQuoteForm:lt;/h3gt;lt;pgt;Pleaseprovideyourcontactinformation.lt;/pgt;lt;pgt;lt;inputname=quot;companyquot;type=quot;textquot;id=quot;companyquot;style=quot;color:Gray;height:24px;width:260px;font-size:110%;quot;onfocus=quot;if(this.value=='Company:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Company:'}quot;value=quot;Company:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;contactquot;type=quot;textquot;id=quot;t_contactquot;style=quot;color:Gray;height:24px;width:220px;font-size:110%;quot;onfocus=quot;if(this.value=='Contact:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Contact:'}quot;value=quot;Contact:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;emailquot;type=quot;textquot;id=quot;t_emailquot;style=quot;color:Gray;height:24px;width:260px;font-size:110%;quot;onfocus=quot;if(this.value=='e-Mail:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='e-Mail:'}quot;value=quot;e-Mail:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;address1quot;type=quot;textquot;id=quot;address1quot;style=quot;color:Gray;height:24px;width:220px;font-size:110%;quot;onfocus=quot;if(this.value=='Address1:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Address1:'}quot;value=quot;Address1:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;address2quot;type=quot;textquot;id=quot;address2quot;style=quot;color:Gray;height:24px;width:220px;font-size:110%;quot;onfocus=quot;if(this.value=='Address2:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Address2:'}quot;value=quot;Address2:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;countryquot;type=quot;textquot;id=quot;countryquot;style=quot;color:Gray;height:24px;width:220px;font-size:110%;quot;onfocus=quot;if(this.value=='Country:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Country:'}quot;value=quot;Country:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;cityquot;type=quot;textquot;id=quot;cityquot;style=quot;color:Gray;height:24px;width:220px;font-size:110%;quot;onfocus=quot;if(this.value=='City:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='City:'}quot;value=quot;City:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;statequot;type=quot;textquot;id=quot;statequot;style=quot;color:Gray;height:24px;width:50px;font-size:110%;quot;onfocus=quot;if(this.value=='State:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='State:'}quot;value=quot;State:quot;/gt;amp;nbsp;lt;inputname=quot;zipquot;type=quot;textquot;id=quot;zipquot;style=quot;color:Gray;height:24px;width:80px;font-size:110%;quot;onfocus=quot;if(this.value=='ZipCode:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='ZipCode:'}quot;value=quot;ZipCode:quot;/gt;lt;/pgt;lt;pgt;lt;inputname=quot;phonequot;type=quot;textquot;id=quot;phonequot;style=quot;color:Gray;height:24px;width:160px;font-size:110%;quot;onfocus=quot;if(this.value=='Phone:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Phone:'}quot;value=quot;Phone:quot;/gt;amp;nbsp;lt;inputname=quot;faxquot;type=quot;textquot;id=quot;faxquot;style=quot;color:Gray;height:24px;width:160px;font-size:110%;quot;onfocus=quot;if(this.value=='Fax:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Fax:'}quot;value=quot;Fax:quot;/gt;lt;/pgt;lt;pgt;lt;textareaname=quot;projdescriptionquot;cols=quot;quot;rows=quot;quot;id=quot;projdescriptionquot;style=quot;color:Gray;height:200px;width:380px;font-size:110%;quot;onfocus=quot;if(this.value=='ProjectDescription:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='ProjectDescription:'}quot;gt;ProjectDescription:lt;/textareagt;lt;/pgt;lt;pgt;lt;textareaname=quot;treatmentsquot;cols=quot;quot;rows=quot;quot;id=quot;treatmentsquot;style=quot;color:Gray;height:100px;width:380px;font-size:110%;quot;onfocus=quot;if(this.value=='SpecialTreatments/Finishes:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='SpecialTreatments/Finishes:'}quot;gt;SpecialTreatments/Finishes:lt;/textareagt;lt;/pgt;lt;pgt;lt;inputname=quot;quantityquot;type=quot;textquot;id=quot;quantityquot;style=quot;color:Gray;height:24px;width:160px;font-size:110%;quot;onfocus=quot;if(this.value=='QuantityRequired:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='QuantityRequired:'}quot;value=quot;QuantityRequired:quot;/gt;amp;nbsp;lt;inputname=quot;timeframequot;type=quot;textquot;id=quot;timeframequot;style=quot;color:Gray;height:24px;width:160px;font-size:110%;quot;onfocus=quot;if(this.value=='Timeframe:'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Timeframe:'}quot;value=quot;Timeframe:quot;/gt;lt;ahref=quot;javascript:cal6.popup();quot;onmousedown=quot;if(timeframe.value=='Timeframe:'){timeframe.style.color='Black';timeframe.style.border='blue2pxsolid';timeframe.value=''}quot;gt;lt;imgsrc=quot;/scripts/img/cal.gifquot;alt=quot;ClickHeretoPickupthedatequot;width=quot;16quot;height=quot;16quot;hspace=quot;4quot;border=quot;0quot;gt;lt;/agt;lt;/pgt;lt;scriptlanguage=quot;JavaScriptquot;gt;lt;!--//createcalendarobject(s)justafterformtagclosed//specifyformelementastheonlyparameter(document.forms['formname'].elements['inputname']);//note:youcanhaveasmanycalendarobjectsasyouneedforyourapplicationvarcal6=newcalendar2(document.forms['form1'].elements['timeframe']);cal6.year_scroll=false;cal6.time_comp=false;//--gt;lt;/scriptgt;lt;pgt;lt;stronggt;AttachaFile:lt;/stronggt;lt;br/gt;lt;smallgt;Pleaseattachprint(s)ofpart(s)tobequotedlt;/smallgt;lt;br/gt;lt;inputtype=quot;filequot;name=quot;attachmentquot;id=quot;attachmentquot;/gt;lt;br/gt;lt;smallgt;6MBMaximum,DOCorPDFlt;/smallgt;lt;/pgt;lt;pgt;lt;stronggt;Comments:lt;/stronggt;lt;br/gt;lt;textareaname=quot;commentsquot;cols=quot;quot;rows=quot;quot;id=quot;commentsquot;style=quot;color:Gray;height:200px;width:380px;font-size:110%;quot;onfocus=quot;if(this.value=='Pleaseprovideanyadditionalinformationthatwouldbeusefulinprocessingyourrequestefficiently.'){this.style.color='Black';this.style.border='blue2pxsolid';this.value=''}quot;onblur=quot;if(this.value==''){this.style.color='Gray';this.style.border='yellow2pxsolid';this.value='Pleaseprovideanyadditionalinformationthatwouldbeusefulinprocessingyourrequestefficiently.'}quot;gt;Pleaseprovideanyadditionalinformationthatwouldbeusefulinprocessingyourrequestefficiently.lt;/textareagt;lt;/pgt;lt;pgt;lt;inputtype=quot;hiddenquot;name=quot;startquot;value=quot;1269530170quot;/gt;lt;inputtype='hidden'name='jc'value='On'/gt;lt;noscriptgt;lt;inputtype='hidden'name='jc'value='Off'/gt;lt;/noscriptgt;lt;scriptgt;document.write(quot;lt;inputtype='submit'name='submit'id='submit'value='Submit'onblur=\quot;if(contact.value==''){contact.value='Contact:'};if(email.value==''){email.value='e-Mail:'};\quot;onmousedown=\quot;if(contact.value=='Contact:'){contact.value=''};if(email.value=='e-Mail:'){email.value=''};\quot;/gt;quot;);lt;/scriptgt;lt;noscriptgt;lt;h3gt;Youmusthavejavascriptontosubmitthescriptlt;/h3gt;lt;/noscriptgt;lt;/pgt;lt;/formgt;lt;scriptgt;//formfieldsdescriptionstructurevara_fields={'contact':{'l':'Contact','r':true,'t':'t_contact'},'email':{'l':'e-Mail','r':true,'t':'t_email'}},o_config={'to_disable':['submit'],'alert':1}//validatorconstructorcallvarv=newvalidator('form1',a_fields,o_config);lt;/scriptgt;lt;pgt;amp;nbsp;lt;/pgt;
Back to the top
 
Posted
Rating:
#59262
Avatar

Fan in action

Thanks for the quick reply, Chris

I'll take a quick peek into the catalog entry system solution.

I was assuming there would be a way to just add form fields to the contact page using comcode or the templating system.

Having a system similar to CFormsII for WordPress in ocP would be awesome for a future release.
Back to the top
 
Posted
Rating:
#59265
Avatar

Fan in action

Chris,

Would I insert custom html form code directly in a page or would it be best to create a block and insert that block as a comcode tag?

Back to the top
 
Posted
Rating:
#59266
Avatar

Fan in action

ps. Also a little confused inserting a block into a page.

ie BLOCK_MAIN_CONTACT_US.tpl but the call in is lower case ???

I made a new template called BLOCK_MAIN_CONTACT_QUOTE but not sure how to call it in… ??
Back to the top
 
Posted
Rating:
#59282
Avatar

Hi,

(Feedback noted)

Blocks are not directly related to templates. For main_contact_us, the PHP code for that block loads up that template, but it's indirect.

To be honest I would simply use the Comcode 'html' tag or the 'semihtml' tag. It makes it pretty easy, and I think from your other topic this is what you're now doing. On this site we do it loads to generate the very precise HTML and CSS we have on various pages.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: