XF 2.1 Node page: simple contact form

-Eric-

Member
How to add a simple form (HTML Template)?
1 combobox
send button

HTML:
<form class="???" action="????.php" method="POST" name="frm_order">
   <select required name="opc_order">
   ...
   </select>
   <button class="????" name "submit" type="submit">Send</button>
</form>

in the email I receive contains: the selected option, username and email of the user.
This form will be used to receive requests from users.

If "Contact URL" could apply permission (registered users only), it would help a lot.
I disabled it because I don't want to receive contact from visitors.
 
Last edited:
You might have better results by just allowing the contact_form template to be seen by registered users and prompting others to sign up.

It might still let a few unscrupulous emails to get through as they know you're running XF and it may skip that step. Or, it stops the bots completely.

You'd have to test.
 
does anyone know how to email admin? form added to Page/node (in the message include: selected item, username and email)
I completely forgot about revisiting this thread. You're going to want to edit the contact_form template and add this above <xf:form
HTML:
<xf:if is="$xf.visitor.user_id">
And this after </xf:form>
HTML:
<xf:else />
    <div class="block-container">
        <div class="block-body">
            You must be signed in to see use the contact form.
        </div>
    </div>
</xf:if>

This will show members this:
1570620522132.webp

And guests this:
1570620419896.webp

Some formatting (padding) should be done to make it look better, but, the contact form will work as you want when anyone clicks "Contact us". I don't know if bots/automated scripts can bypass this and directly submit the form as it's not "blocked" per se.
 
as I described earlier (I deleted the message) ... I know I could edit contact_form (remove the visitor part), but I prefer to know how to create a simple form, add it to the page (node). I copied the code "contact us", but it doesn't work, it must be because I disabled it.

I didn't want to add a PHP file to send email.
You could enable it and remove it as shown, plus remove it from the footer, and the code within contact_form would hypothetically still work.

Then set permissions on that node.

I wouldn't want an external script either...
 
Back
Top Bottom