close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Image required in form - jquery

Thread began 2/09/2016 7:50 am by iain331081 | Last modified 2/10/2016 3:42 pm by Ray Borduin | 2417 views | 15 replies |

iain331081

Image required in form - jquery

I have a form with some required fields.

<input id="update_title" name="update_title" type="text" tabindex="1" title="Please enter a title." required="true">

Works for a text field, but

<input id="news_image_small" name="news_image_small" type="file" class="connect_button" tabindex="4" title="Please upload an image to accompany your news story." required="true">

What am I missing?

Sign in to reply to this post

Ray BorduinWebAssist

That should work. Do you have a sample URL where I can test?

Sign in to reply to this post
Did this help? Tips are appreciated...

iain331081

Thanks Ray - details below.

Sign in to reply to this post

Ray BorduinWebAssist

Update line 26 to:

$WAFV_Redirect = "index.php?invalid=1&LodgeID=". ((isset($_POST["LodgeID"]))?$_POST["LodgeID"]:"") ."";

That will add the invalid $GET variable when the validation fails and trigger the repopulating of the other form elements.

You have a misplaced </div> tag on line 275... that might be causing the file fields to not validate properly with jquery.

Sign in to reply to this post
Did this help? Tips are appreciated...

iain331081

Thanks Ray.

I made that change, but still isn't working.

I have restored a version from my local backup that had the validation on the image width working, and uploaded that...

Sign in to reply to this post

Ray BorduinWebAssist

Line 13 should be:
$image_info2 = getimagesize($_FILES["news_image"]["tmp_name"]);

Sign in to reply to this post
Did this help? Tips are appreciated...

iain331081

Thanks Ray - that has fixed the validation on the width values of the images.

But the jQuery validation still isn't working if they are blank, and still losing the title and details text if the form is submitted when the image validations fail.

Sign in to reply to this post

Ray BorduinWebAssist

You still have mismatched <div> tags and malformed html on the page. If you give me a url to view it live and FTP access I'll look into it further.

Sign in to reply to this post
Did this help? Tips are appreciated...

iain331081

Thanks Ray.

I looked at that and still don't see the mismatched <div> tag after commenting them all.

Sign in to reply to this post

iain331081

OK - I spotted the issue with the <div>s needing to be within another row, so that has fixed the query validation when no images are selected.

So the only thing wrong now is the title and details fields retaining any text if the image width heights validations fail so that people don't lose it and need to add it again.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...