Dreamweaver Club Forums

Dreamweaver Club Forums (http://www.dreamweaverclub.com/forum//index.php)
-   Spry (http://www.dreamweaverclub.com/forum//forumdisplay.php?f=189)
-   -   Init val satisfing spry required text area (http://www.dreamweaverclub.com/forum//showthread.php?t=34250)

deafboyzaudio 11-05-2009 08:14 PM

Init val satisfing spry required text area
I have this code:

<textarea name="setup" cols="30" rows="2" class="indent" id="setup" tabindex="80" onfocus="if(this.value == 'Give a brief description of your Car Audio upgrades...') {this.value = '';}">Give a brief description of your Car Audio upgrades...</textarea>
That particular text area has the 'initial value' as you can see.... and that text area is required to have text in it by way of spry.

My issue is this... if the user skips over this text area, the spry thinks that the initial value is actually what the user types in, so it doesnt throw an error...

how do i make it so that spry sees this init val as no value at all?


edbr 11-05-2009 11:20 PM

you could look at the validation and add if field==' ',
|| field == "
Give a brief description of your Car Audio upgrades..."
hard to asay exactly without seeing the validation but that as an idea should work i would say

deafboyzaudio 11-06-2009 02:41 AM

OK when you say add that to the validation do you mean the spryValidationTextarea.js file in the spry assets folder? I would post that file up here but its 1000 lines.

I'm not too good at hand coding like that... I couldnt help notice that there was "Spry.Widget.ValidationTextarea.ONSUBMIT = 4;" in that file... I was thinking something like that might work... if i could code something like

on submit="if(this.value == 'Got ideas for site content? Link to it here...') {this.value = '';}"
to me that works but to DW it doesnt...:mad:

Im still a hand coding noob so please guide me along...:mrgreen:

DWcourse 11-06-2009 03:56 AM

If I understand what's going on, you don't want to use an initial value for the field. Select the whole Spry area (it should be wrapped in a <span id="sprytextfield1"> tag) and in the Properties Inspector apply a hint instead.

deafboyzaudio 11-06-2009 04:41 PM

Ok did that and it works. Thanks a lot DWcourse!!!!:mrgreen:

I did have one other question though regarding some other spry options if you guys dont mind....

<label for="song" class="margin">Song Name:</label>
        <br />
        <span id="sprytextfield2">
  <input name="song" type="text" class="indent" id="song" tabindex="20" size="13" maxlength="30" />
  <span class="textfieldRequiredMsg">Required</span></span>
<label for="artist">Artist:</label>
        <span id="sprytextfield1">
          <input name="artist" type="text" id="artist" tabindex="30" size="13" maxlength="30" />
          <span class="textfieldRequiredMsg"></span></span>
<input type="checkbox" name="unknown" id="unknown" tabindex="" />
        <label for="unknown">Unknown</label><p>

Thats some code for a differnt part.... I want the song name and artist required with spry, but if the user checks the 'unknown' box, I want those text fields to not be required....
would this be done with javascript or a php if statement? can you give a hint to how that might be done? Thank you much

All times are GMT. The time now is 11:00 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com