Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Two contact forms on one page - JQuery

Featured Replies

Hi Guys,

 

One of my clients requires two contact forms on one page which he would like to be done using JQuery. One contact form is for "New customers" and the other for "Existing Customers".

 

Only one of these forms can be showing at anyone time and it must be non confusing for the client. I have been toying with the idea of using tabs or maybe even a sliders?

 

What would you use in this scenario? If you can find any JQuery addons that would do this could you post them!

 

Cheers guys :)

how do you determine if they are a new or existing client?

 

If it's a PHP page then can't you just condition which form is shown?

I would just make two nice, large, elegant buttons 'Existing Client', 'New Client'. Make them link to /the-page/?client=existing and /the-page/?client=new. You can then use $_REQUEST to decide which form to show with some PHP. This will deal with those with Javascript disabled.

 

On the selection page, print both forms HTML but set them to display:none in your CSS, then add some jQuery for those with Javascript enabled. You can then catch the .click() function on the buttons to prevent page reloading and just hide the buttons/show the appropriate form. Probably 5 lines of jQuery.

 

These two methods combined will enable the forms for everyone, in an understandable way. Those without stylesheets enabled will see both forms since display:none will have no effect, so make sure you label the forms nicely for that minority.

Edited by andyl

If you have two separate forms and one button for each, why not use jQuery expand/contract show/hide code to show only one form when the appopriate button is clicked? PHP can do this too.

 

I've got a PHP example here in item 1

http://www.wickham43.net/showform.php

Click Form Example and the form will show. You could have two links or buttons for two forms (only one at a time will show).

Edited by Wickham

  • Author

Cheers for all of the help guys.

 

I do like the elegant button idea that sounds great!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.