close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Doubling client side validation enabling form field on DA insert page

Thread began 8/31/2009 11:02 pm by afkrennie381204 | Last modified 9/04/2009 2:28 pm by Eric Mittman | 2820 views | 5 replies |

afkrennie381204

Doubling client side validation enabling form field on DA insert page

Hi

I've build Data Assist insert pages using a required template with editable content region.

Now using Validation Toolkit to enable a disabled form field on conditional checking of a box. The recipe points out it's essential to double the client-side behaviour application onto the body tag - which of course it is - however because I've used a template with an editable content region I can no longer edit in the body tag...tried everything I can think of!

So, my question is, how to do this doubling of client-side validation on the body tag when working in a Data Assist page?

Many thanks,

Ann

p.s. will post this on DA area of the forum to

Sign in to reply to this post

Eric Mittman

You will not be able to directly edit the body tag when the page is template derived. I think the easiest way to make this edit would be to just add in a script reference somewhere in the head editable region, then just put in the js code you would normally have in the body onload event just inside of the script tags like this:

<body onload="some js code here;">

Move to:

<head>
<script type="text/javascript>
some js code here;
</script>
</head>

This should accomplish the same thing and give you the same result. I'll update your other post with a reference to this one, please only update this post.

Sign in to reply to this post

afkrennie381204

Doubling client side validation enabling form field on DA insert page

Thanks Eric - didn't work for me unfortunately. My exact code below (tried both with and w/out "" around js subcode)

<!-- InstanceBeginEditable name="head" -->
<head>
<script type="text/javascript">
"WAValidateRQ(document.forms[0].partgroup,'- Entry is required',document.forms[0].partgroup,0,true,'checkbox');WAValidateEN(document.forms[0].partgroup,document.forms[0].group_code,true);WAValidateRQ(document.forms[0].partgroup,'- Entry is required',document.forms[0].partgroup,0,true,'checkbox')";
</script>
</head>

The page is working as fine including as expected with single validation (just on the checkbox itself) so the problem is isolated down to this issue.

You mentioned this the easiest way to get around the problem - it's essential I have this functionality as I've lots of conditional entries in my forms so please - unless you can spot what I'm doing wrong in the script above - can you suggest another way to make this work...I don't care how long-winded, I'd just be grateful for your solution.

Many thanks Eric, your assistance is hugely appreciated.

Ann

Sign in to reply to this post

Eric Mittman

The code looks like it should work, you will want to ensure that it appears after the validation toolkit code on the page or it may not work correctly. I changed it up just slightly for you, I removed the unneeded quotes and broke the calls into multiple lines like this:

<script type="text/javascript">
WAValidateRQ(document.forms[0].partgroup,'- Entry is required',document.forms[0].partgroup,0,true,'checkbox');
WAValidateEN(document.forms[0].partgroup,document.forms[0].group_code,true);
WAValidateRQ(document.forms[0].partgroup,'- Entry is required',document.forms[0].partgroup,0,true,'checkbox');
</script>



Reading over your original post again though I'm not sure if you would need all of this code in the onload event to make it work properly. You may be able to get away with some much simpler code on the page. What is the problem with the way the page loads currently? If you are just trying to make one of the form elements disabled or enabled by default this can be done with some code like this:

<script type="text/javascript">
document.forms[0].group_code.disabled=true
</script>



This would make the group_code element disabled when the page loads. If you want to make the element enabled by default you could set this to false instead of true.

Sign in to reply to this post

afkrennie381204

Doubling of client-side validation in DA with VTK

Hi Eric,

Thanks for your reply - still not working unfortunately. Just to summarise the problem:

I have 2 fields in a DA Insert page:
1) checkbox asking if the order is part of a group - it may or may not be for an order to be valid
2) textfield accepting a group code [initially disabled then enabled through client-side validation if 1) is checked]

I have applied server validations and bound the validated entries to the form so that if one field fails, and the form reloads (which I ask it to) then the correct entries are stuck on. Bizarrely, I've noticed that the content of 2) is bound even if it is NOT valid.

If the page is reloaded then 2), the textfield is disabled again, even if the checkbox 1) is ticked. This means that if the content entered in the textfield 2) needs to be reentered then it's inaccessible.

So unfortunately a default enabled/disabled function on a "body onload" substitute in the header doesn't fit in with the purpose of the form as 2) may/may not need to be enabled/disabled on reload.

I've put the lengthier code in the editable head, right at the end so all other Validations must come before it. It seemed to even disable the original (on checkbox) enabling client-side validation i.e. the textbox 2) wouldn't enable even when the checkbox 1) was checked.

Yikes. Don't know what to do now. I'll keep trying and update you later today.

Please bear with me - I really need to crack this Eric. Many thanks again,

Ann

___________

Update:

Still no joy...I await advice. Many thanks Eric, Ann

Sign in to reply to this post

Eric Mittman

I want to be sure that I understand the situation correctly, you have client side validations applied, and would like to have a form element enabled/disabled when the page is reloaded or the form submitted? If this is the case you are going to have difficulty getting this in place, if you are only using client side validations the values will be lost when the page is reloaded.

If you are just trying to get one text field to appear and another to hide depending on the selection made you should take a look at this thread here:

showthread.php?t=3606

In post 4 I have some step by step directions and an example page for this type of validation. Take a look and see if this will fit your needs. If not I could help advise on what may need to be modified if it needs to work differently.

Sign in to reply to this post

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