Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2004
    Posts
    1,904

    PHP Help on Contact Form

    I am wanting to add a few fields that will be required fields to the following form code:

    PHP Code:
    {*
    +----------------------------------------------------------------------
    Templatecontact.tpl

    This template is used to display the "Contact Us" form, as well
    | as the list of articles returned by the automated reply system, if
    it is enabled.
    +----------------------------------------------------------------------
    *}
    {include 
    file="header.tpl" action="Submit a Ticket"}

    <
    h2>Submit a Ticket</h2>

    If 
    you can't find a solution to your problem in our knowledgebase, you can submit a Ticket by selecting the appropriate Department below.
    <br><br><font color="#cc3333">Please use the e-mail address we have on record for your account or your ticket will not be successfully submitted.</font><p />


    {if count($articles) }

        <h3>Inquiry not yet Submitted</h3>

        <div class="lore_content_box">

            To better assist you in finding the answer to your question as fast 
            as possible, we found the following articles that may be relevant to your
            inquiry:
            
            <br /><br />
            {include file="articles.tpl"}
            <br />


            If the above articles do not answer your question, use the form below to send your inquiry to our support team.
        </div>

        <br />
    {/if}

    {if !$form.readonly}
        <form method="{$form.method}" enctype="multipart/form-data" action="{$form.action}">
    {/if}

    <input type="hidden" name="action" value="{$form.submit_action}" />

    {if count($articles) }
        <input type="hidden" name="already_viewed_relevant_articles" value="1" />
    {/if}

    {foreach name=hidden_field_loop item=hidden_field from=$hidden_fields}
        {$hidden_field.html}
    {/foreach}

    <table class="lore_form_table" width="450" cellpadding="0" cellspacing="2" border="0">

        {if $form.has_errors }
            <tr>
            <td class="lore_form_errors" colspan="2" width="100%">
        
                {if $form.num_errors > 1}
                    <small><strong>{$form.num_errors} errors were found.</strong></small>
                {else}
                    <small><strong>1 error was found</strong></small>
                {/if}
        
            </td>
            </tr>
        {/if}

        <tr>
        <td class="lore_form_field_info" width="30%" valign="top">
            Full Name:    
        </td>
        <td class="lore_form_field" width="70%" valign="middle">
            {section name=error_loop loop=$fields.name.errors}
            <span class="lore_form_error">{$fields.name.errors[error_loop]}</span><br />
            {/section}

            {if !$form.readonly}
                <input class="lore_input" type="text" name="{$fields.name.id}" value="{$fields.name.html_escaped_value}" size="30" maxlength="255" />
            {else}
                {$fields.name.display_value}
            {/if}
        </td>
        </tr>

        <tr>
        <td class="lore_form_field_info" width="30%" valign="top">        
            Email:
        </td>
        <td class="lore_form_field" width="70%" valign="middle">
            {section name=error_loop loop=$fields.email.errors}
            <span class="lore_form_error">{$fields.email.errors[error_loop]}</span><br />
            {/section}
            {if !$form.readonly}
                <input class="lore_input" type="text" name="{$fields.email.id}" value="{$fields.email.html_escaped_value}" size="50" maxlength="255" />
            {else}
                {$fields.email.display_value}
            {/if}
        </td>
        </tr>
        <tr>
        <td class="lore_form_field_info" width="30%" valign="top">        
            Re-enter Email:
        </td>
        <td class="lore_form_field" width="70%" valign="middle">
            {section name=error_loop loop=$fields.email_reenter.errors}
            <span class="lore_form_error">{$fields.email_reenter.errors[error_loop]}</span><br />
            {/section}
            {if !$form.readonly}
                <input class="lore_input" type="text" name="{$fields.email_reenter.id}" value="{$fields.email_reenter.html_escaped_value}" size="50" maxlength="255" />
            {else}
                {$fields.email_reenter.display_value}
            {/if}
        </td>
        </tr>

        <tr>
        <td class="lore_form_field_info" width="30%" valign="top">        
            Subject:
        </td>
        <td class="lore_form_field" width="70%" valign="middle">
            {section name=error_loop loop=$fields.subject.errors}
            <span class="lore_form_error">{$fields.subject.errors[error_loop]}</span><br />
            {/section}

            {if !$form.readonly}
                <input class="lore_input" type="text" name="{$fields.subject.id}" value="{$fields.subject.html_escaped_value}" size="50" maxlength="255" />
            {else}
                {$fields.subject.display_value}
            {/if}

        </td>
        </tr>

        <tr>
        <td class="lore_form_field_info" width="30%" valign="top">        
            Message:
        </td>
        <td class="lore_form_field" width="70%" valign="middle">
            {section name=error_loop loop=$fields.body.errors}
            <span class="lore_form_error">{$fields.body.errors[error_loop]}</span><br />
            {/section}

            {if !$form.readonly}
                <textarea class="lore_input" name="{$fields.body.id}" rows="10" cols="60">{$fields.body.html_escaped_value}</textarea>
            {else}
                {$fields.body.display_value}
            {/if}
        </td>
        </tr>

    </table>

    {if !$form.readonly}
        <div class="lore_form_buttons">
            <input class="lore_button" name="{$buttons.submit.id}" type="submit" value="Send Email" />
            <input class="lore_button" type="reset" value="Reset" />
        </div>
    {/if}

    {if !$form.readonly}
        </form>
    {/if}

    {include file="footer.tpl"} 

    The fields I want to add are a drop down with department names and then one for Domain name/ Username/Billing password.

    Any suggestions would be awesome.

    Thanks!
    jerett


  2. #2
    Join Date
    May 2004
    Location
    Pflugerville, TX
    Posts
    11,222
    Moved to Programming
    Studio1337___̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡.__Web Design

  3. #3
    Join Date
    Sep 2004
    Posts
    1,904
    Or - we could creative on the form and make it have unique fields for each selected department. If anyone has some free time and wants to attempt this - I would really appreciate it. Do I sound desperate yet?


  4. #4
    Join Date
    Sep 2004
    Posts
    1,904
    Some insight on this project:

    First off - It is probably obvious I am trying to use this form as my ticket submission area. Since I will be utilizing ClientExec - this will be an easy task to just have the info submitted by the form to be sent directly to CE where a ticket will be created.

    The reason why I don't want to necessarily start from scratch is because this has a great feature, much like other helpdesk, where they first present you with article suggestions before your submit the ticket. That is a very helpful feature and thus why I am hoping to find a way to incorporate a few additional fields.

    I thank you in advance for all your consideration.


  5. #5
    Join Date
    Sep 2004
    Posts
    1,904
    well this is hopeless attempt to get help. I appreciate the willingness though. I am going ot have to figure something out.


  6. #6
    Join Date
    Feb 2003
    Location
    Canada
    Posts
    958
    With no prior experience in ClientExec, and at the risk of accusing me of coding out of proportion, the only thing I could think of doing, without hacking SQL/PHP code is the following.

    - Create a hidden field that will eventually store the 'subject'
    - Create a hidden field that will eventually store the 'message'

    - Rename the two fields used currently to something unique (both the subject and message fields)

    - Create the 2 dropdowns that you require (Departments and Reference type), aswell as the text box for the reference value (domain, etc)

    - On submit call a function that:
    :: appends [Department] to the subject line, and stores it in the hidden field (by using document.getElementById().value)
    :: appends the value of the dropdown box and the value of the textbox to the top of the message, and store the message in the hidden field.
    :: submits the form

  7. #7
    Join Date
    Sep 2004
    Posts
    1,904
    I think I am confusing people - All I need is to add additional fields to the current contact form listed about. That is all. Any suggestions? Or if any one can point to a site that will show me how to setup my own contact form with required field errors that show up on the same page - not on a different page asking you to click back.

    Thanks


  8. #8
    Join Date
    Sep 2004
    Posts
    1,904
    anyone have any suggestions?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •