close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

server validation on radio group

Thread began 8/25/2016 3:36 pm by Jamie | Last modified 9/01/2016 12:46 pm by Ray Borduin | 1343 views | 12 replies |

Jamie

server validation on radio group

Hi Ray

Which option would I choose to make an input field required based on the selection of a radio group with 2 radios which are set to 0 or 1. Am trying to set another field to fail validation if it is empty and the radio value is set to 1

I tried type 'Number' but that didnt work so not sure which would be best for this instance?

Cheers

Sign in to reply to this post

Ray BorduinWebAssist

What kind of validation? Server or jquery html5?

Sign in to reply to this post

Jamie

Server Validations

Sign in to reply to this post

Ray BorduinWebAssist

You would use required validation and the validated value would be something like:

php:
<?php echo(($_POST['RadioName']=="1")?$_POST['ConditionalFieldName']:"pass"); ?>
Sign in to reply to this post

Jamie

OK, not 100% sure where and what that needs to be.

The radio group name is ExternalBodywork and the input field to be validated is ExternalBodyworkNotes if ExternalBodywork = 1

So, I have tried this

<?php echo(($_POST['ExternalBodywork']=="1")?$_POST['ExternalBodyworkNotes']:"pass"); ?>


which just gives me an error

Notice: Undefined index: ExternalBodywork in /home/motle7bk/public_html/clients/hazel2/admin_cms/vehicleinspections_insert.php on line 268
pass



I have also tried adding it to the server validations like this

$WAFV_Errors .= WAValidateRQ(((isset(($_POST['ExternalBodywork']=="1")?$_POST['ExternalBodyworkNotes']:"pass") . "",false,6);



which just creates a blank screen (with error reporting turned on)

What am I doing wrong?

Sign in to reply to this post

Ray BorduinWebAssist

Can I see a copy of the page? The error implies the radio button name isn't 'ExternalBodywork'

Sign in to reply to this post

Jamie

thanks and here you go

Attached Files
vehicleinspections_insert.php
Sign in to reply to this post

Ray BorduinWebAssist

It seems like this would work:

php:
<?php echo(($_POST['ExternalBodywork']=="1")?$_POST['ExternalBodyworkNotes']:"pass"); ?>



maybe it is an issue in your radio button missing the space between the name and value attributes in the html?

Sign in to reply to this post

Jamie

thats not it....still getting an error: http://prntscr.com/cceggo

Sign in to reply to this post

Ray BorduinWebAssist

That is supposed to be the value you are validating in server validations... not the value you display in the html. I think you are using the code in the wrong place. That was supposed to be entered in the Server Validation interface.

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...