midasxl's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Active Members
Active Posts:
188 (0.1 per day)
Joined:
03-December 08
Profile Views:
6,944
Last Active:
User is offline Mar 13 2014 08:44 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0

Latest Visitors

Icon   midasxl has not set their status

Posts I've Made

  1. In Topic: Character used as javascript separator. What is it?

    Posted 9 Oct 2013

    View PostCraig328, on 09 October 2013 - 09:23 AM, said:

    Hm. If it evaluated to a comma then you'd think you should be seeing ",light,".


    I do get ",light," when I alert the resultsArr. Then after the pop I alert again and get ",light". Then the code proceeds to trim the first character (the remaining comma).

    $.trim(resultsArr[0])
    
    


    Why all the trouble? Why not just return "light" in the first place??? This is legacy code by the way.

    Thanks!
  2. In Topic: Character used as javascript separator. What is it?

    Posted 9 Oct 2013

    Hello and thanks for youre time. I have a quick question regarding a strange character used as a separator in javascript.

    Coldfusion returned to an ajax block:
    <cfoutput>:-:</cfoutput>
    <cfoutput>#session.themeColor#</cfoutput>
    <cfoutput>:-:</cfoutput>
    
    


    Javascript which consumes the callback (partial):
    success: function(results){
    var resultsArr = results.split(":-:");
    resultsArr.pop();
    }
    
    


    Let's say the #session.themeColor# holds the value of "light".

    I dumped resultsArr and got ",light,"

    After the pop(), the last item in the array was removed and I got ",light"

    So the ":-:" resolves to a comma??? I've never seen this before, so I'm just looking to learn about this one.

    Any guidance will be greatly appreciated as always!

    Thanks!
  3. In Topic: Build Array using CFLOOP with Form Values

    Posted 14 Aug 2013

    This is a fantastic solution and description; thank you very much! It works great. I delve into ColdFusion markup on occasion due to some legacy apps. Now that I have a complete working solution (of this small portion of the overall form), here is this section of the form to possibly benefit others who may view this. Thanks!

    The HTML begins with a div holding a pair of radio buttons. The user has the option of adding additional radio buttons via a jquery clone method. The div around the radio buttons is the tag that is cloned (including its contents). Upon being cloned the names of the radio buttons are changed to differentiate them from the first cloned pair.

    HTML (before clone):
    
    <div>
    <input type="radio" name="DHCP0" value="yes" />  
    <input type="radio" name="DHCP0" value="no" />  
    <input type="hidden" name="dhcpCounter" value="dhcpCounter" />
    </div>
    
    
    


    HTML (after 1 clone):
    
    <div>
    <input type="radio" name="DHCP0" value="yes" />  
    <input type="radio" name="DHCP0" value="no" />  
    <input type="hidden" name="dhcpCounter" value="dhcpCounter" />
    </div>
    
    <div><!-- I am a clone of the above div, appended here -->
    <input type="radio" name="DHCP1" value="yes" />  
    <input type="radio" name="DHCP1" value="no" />  
    <input type="hidden" name="dhcpCounter" value="dhcpCounter" />
    </div>
    
    
    


    I keep track of how many radio pairs using the hidden field "dhcpCounter"

    CFML:
    <cfset dhcpCount = listLen("#FORM.dhcpCounter#", ",")>
    
    


    Then I build an array of the user selections from each radio pair. The form is validated on the front end which requires the user to make a selection; no empty values come across.

    CMFL (cont'd):
    <cfset dhcpCount = listLen("#FORM.dhcpCounter#", ",")>
    <cfset dhcpArray = ArrayNew(1)>
    <cfloop index="i" from="0" to=#dhcpCount#>
       <cfset variables.newArrayVal = "">
       <cfif isDefined("FORM.DHCP#i#")>
          <cfset variables.newArrayVal = FORM["DHCP#i#"]>
          <cfset ArrayAppend(dhcpArray, variables.newArrayVal)>
       </cfif>
    </cfloop>
    
    


    Once the array is built (and this could be up to 9 groups of radio buttons), I process the array into an html email:

    CFML (cont'd):
    <cfloop index="i" from="1" to="#dhcpCount#">
       <cfparam name="dhcpArray[i]" default="na"><!---if not already defined, define it here with the default value--->
       <cfif dhcpArray[i] is not "na">
          <p>Does host obtain IP through DHCP? #dhcpArray[i]#</p>
       </cfif>
    </cfloop>
    
    


    That's the bulk of it at this point. There's a whole lot more going on around this small portion of the form, but this tackles the issue I was having. Hope this helps others, and a BIG thanks to Craig328 for helping me!

    Cheers!
  4. In Topic: What does this regex replace do?

    Posted 19 Jun 2013

    Great information! Thanks!

    A couple of things that were not evident to me:

    I thought the * was not treated as a special character when it was inside square brackets, so I thought the * was a literal character. I didn't realize there was a space in the -% range. (As in 'space' TO %).

    Thanks everyone, this really clears things up for me!

    Cheers!
  5. In Topic: Display data from two tables - one to many relationship

    Posted 24 Jan 2013

    Thanks for the suggestions, I have put them to use and have come up with the following. I changed/added a couple of column names and re-named the table names. Hope that doesn't confuse viewers in relation to the earlier posts.

    $sql = "SELECT x.eventid, title, discipline, body, eventlocation, date, imagepath, eventdate, starttime, endtime FROM cae_events_info as x INNER JOIN cae_event_dates as y on x.eventid=y.eventid ORDER BY x.eventid";
    $result = mysql_query($sql);
    if($result)
    {
        $currGroup = -1;
        while($row = mysql_fetch_array($result))
    	{
           if($row['eventid'] != $currGroup)
    		{
    		echo '<hr>';
    			$currGroup = $row['eventid'];
    			$day = 1;
    			echo 'Event ID: ' . $row['eventid'] . "</br>";
    			echo 'Event Title: ' . $row['title'] . "</br>";
    			echo 'Discipline: ' . $row['discipline'] . "</br>";
    			echo 'Event Description: ' . $row['body'] . "</br>";
    			echo 'Event Location: ' . $row['eventlocation'] . "</br>";
    			echo 'Date Added: ' . $row['date'] . "</br>";
    			echo 'Image Path: ' . $row['imagepath'] . "</br>";
    			echo 'Dates: </br>';
    		}
    		echo 'Date ' . $day . ': ' . $row['eventdate'] . "</br>";
    		echo 'Start Time: ' . $row['starttime'] . "</br>";
    		echo 'End Time: ' . $row['endtime'] . "</br>";
    		$day++;
        }
    }
    
    


    With the two test events currently in the database, the above produces the following:

    Event ID: 18354
    Event Title: x
    Discipline: x
    Event Description: x
    Event Location: x
    Date Added: 2013-01-25
    Image Path: event_images/exampleGIF.gif
    Dates:
    Date 1: 2013-01-06
    Start Time: 02:00:00
    End Time: 02:30:00
    Date 2: 2013-01-05
    Start Time: 01:00:00
    End Time: 01:30:00
    Date 3: 2013-01-04
    Start Time: 12:00:00
    End Time: 12:30:00

    Event ID: 22185
    Event Title: t
    Discipline: t
    Event Description: t
    Event Location: t
    Date Added: 2013-01-25
    Image Path: event_images/exampleGIF.gif
    Dates:
    Date 1: 2013-01-26
    Start Time: 01:00:00
    End Time: 02:00:00

    This is great! A very promising start. I now have to work on formatting for display in the browser. Within the multi-date event I would like to order the dates properly. Right now they're listed in reverse order.

    If anyone sees room for improvement, I will welcome more suggestions.

    Thank you all!

    Cheers!

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

midasxl hasn't added any friends yet.

Comments

midasxl has no profile comments yet. Why not say hello?