Support » Plugin: Participants Database » Help with text area field

  • I’m trying to have multiple pieces of data in a text area field.

    The field collects name, age, and gender. I need this to allow the participant to enter more than one line at a time in this field which is why I’m using a text area rather than a text line.

    Right now I’m using this regex statement which works great for one line, but seems to fail when I enter a second, third, fourth, etc… line of data.
    #^[a-zA-Z]+\s+[0-9]+\s+[(?:m|M|f|F|)$]{1}$#i

    It would be great if the statement added a comma or \r or
    after each line so I can format the results display with CSS.

    I also considered creating multiple text fields and somehow combining the display into a single column so it’s not bulky.

    I have made forms where an extra hidden field is displayed with jQuery by clicking on a link but I wouldn’t have any idea where to being hooking that into the signup template.

    Any help is appreciated…
    Thanks!

    http://wordpress.org/plugins/participants-database/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Are you combining the different type of information into a text-area so they can be formatted together? Really, you’re best off not trying to have multiple types of data entered into one field. You can see the difficulty in validating that…and then later on down the road you may want to be able to access those pieces of information separately and it will be a real pain.

    It’s pretty easy to format the output so it doesn’t look like it came from separate fields, if that’s what you need.

    thanks for the good questions…

    It’s actually not “multiple types of data” as I had described it, it’s really more a category, ie family:

    Name, Age, Gender
    Name, Age, Gender
    Name, Age, Gender

    So I was looking at a way of formatting it so it displays line for line in one column. There will never be an instance where this information will be searched individually. It’s a record of family members so it’s the collective data that’s important.

    Plugin Author xnau webdesign

    (@xnau)

    OK, well you’ll need your regex ninja skills if you want to strictly validate that!

    The regex you have there won’t recognize the commas, you need to include those in your character classes or literally if you want to require commas. If you give people a clear example of how you want it formatted, it may work.

    Then to allow line breaks, use the ‘s’ modifier.

    I’ll work on my regex but I guess your suggestion is where I ultimately should go.

    Can you point me in the direction to combine three fields (for example) so it looks like it’s one column?

    Thanks,
    Bob

    @xnau I found a great working solution. I used a text line field with my single line expression above and duplicated the field 4 times.
    then, I just use CSS to display it the way I need to. seems to be a very workable solution for me.

    Sorry but one final question. On fields where I have a regex, it seems to require them being filled out. Is there a fallback for this where it can allow for a blank field?

    #^[a-zA-Z]+\s+[0-9]+\s+[(?:m|M|f|F|)$]{1}$#i

    Plugin Author xnau webdesign

    (@xnau)

    So, you want to validate such that it’s OK to put nothing, but if they do put something, it has to be formatted in a specific way? If you can figure out how to do that with the regex, it will work. I’ve been using this site to help me design my regexes…you might find it helpful: http://www.phpliveregex.com/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Help with text area field’ is closed to new replies.