• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

<cfif> </cfif>

Participant ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

I have an <input type="text" name="pnum">

I want to the color of my text area to change if pnum is left blank....

I am cloudy on how i should get this done and was wondering if i could get some advice

i thought it should work like

<cfif IsDefined("pnum")>
TOPICS
Advanced techniques

Views

616

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 14, 2006 Jun 14, 2006
try it this way

<td align="center" class="bottomLine" ><input style="border:0;<cfif
Len(pnum) IS 0> background-color:Yellow;</cfif>" type="text"
name="pnum#cnt#" value="#res.phone#" maxlength="13" size="10"></td>



--
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
=============================
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/


"PackinDaMAC" <webforumsuser@...

Votes

Translate

Translate
Guest
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

<CFIF Len(pnum) IS 0>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Ok so that would check the length of the string so to change the color

<cfif Len(pnum) IS 0>
<cfset pnum = "FFFFF">
</cfif>

Is that how it would work??? or am i missing something???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

<cfif IsDefined("pnum")>
<cfif Len(pnum) IS 0>
<cfset bgcolor = "FFFFF">
</cfif>

</cfif>
Would this be correct or am i not using the right logic???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

What exactly do you mean by 'left blank'? When the form is loaded? When submit is clicked? After some validation? Please be more specific.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

When the form loads on to the screen there are some that phone numbers are left blank and those phone numbers that are blank i want that area in my table to change color???? Is this not practical using cfml????

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied


<input type="text" name="pnum" style="background-color: <cfif Trim(pnum) IS "">Black<cfelse>White</cfif>" >

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Here is how i did it...My page loads but it does not change the color though....What am I missing???
<td align="center" class="bottomLine" ><input style="border:0; background-color:transparent" type="text" name="pnum#cnt#" value="#res.phone#" maxlength="13" size="10" style="background-color:<cfif Len(pnum) IS 0>Yellow</cfif>"></td>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

try it this way

<td align="center" class="bottomLine" ><input style="border:0;<cfif
Len(pnum) IS 0> background-color:Yellow;</cfif>" type="text"
name="pnum#cnt#" value="#res.phone#" maxlength="13" size="10"></td>



--
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
=============================
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/


"PackinDaMAC" <webforumsuser@macromedia.com> wrote in message
news:e6p9on$1e5$1@forums.macromedia.com...
> Here is how i did it...My page loads but it does not change the color
> though....What am I missing???
> <td align="center" class="bottomLine" ><input style="border:0;
> background-color:transparent" type="text" name="pnum#cnt#"
> value="#res.phone#"
> maxlength="13" size="10" style="background-color:<cfif Len(pnum) IS
> 0>Yellow</cfif>"></td>
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

LATEST
I wonder if something like this isn't better handled by JavaScript.

If you user CF to set the textbox's color, then it only changes on pageload. For instance, it could be blank when the page loads initially, but then the user may enter something but the textbox's color won't change until the next pageload.

If, on the other hand, you use Javascript in the textbox's onChange event to evaluate the textbox's status (blank or not) and then update the textbox's color, then the color will change whenever the user edits the textbox.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation