Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2019
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Form help - Need to code two text fields so that just one of the two are "required"

    Hi all!

    I have run into an issue due to how the anicent CMS, *Lotus Notes*, creates forms (you can't use traditional HTML to code your fields, radio buttons, check boxes etc). This is for work, so I cannot use different software unfortunately. Here is what I need to do:

    In my form, there are two fields:

    • Date of Birth:
    • Serial Number:



    Only one of the two needs to be filled out. If both are blank, the form should not submit. Obviously, I can't make them both required or both *not* required.

    Code:
    <label for="estate"><span class="field-name">Serial number:
    
    [!serialno.code!]
    
    </label>
    
    <label for="estate"><span class="field-name">Date of birth (yyyy/mm/dd):
    
    [!DOB.code!]
    
    </label>
    As you can see, Lotus uses this dumb in-house "Form Design" thing (https://ibb.co/M1fPLt9) to code to show fields etc. (e.g., [!serialno.code!]), and I can't find a way around it as a result.

    I thought I could just make one field saying "Please enter either the serial or your DOB" and make it required; however, these two questions must disapear using "style="display:none" if the user chooses a radio button called "I am submitting this question anonymously". So, they will get an error for an invisible text field if the user goes that route.

    Any suggestions?

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    West Des Moines, Iowa
    Posts
    8,193
    Thanks
    38
    Thanked 1,091 Times in 1,087 Posts
    I suggest learning HTML.

    Look:
    Code:
    <form>
    <label for="estate">Serial number:
        <input id="estate" name="what-you-want-for-php-reconision" type="text" placeholder="!serialno.code!" required>
        </label><br>
        
        <label for="different_estate">Date of birth (yyyy/mm/dd):
                <input id="different_estate" name="what-you-want-for-php-reconision" type="text" placeholder="!DOB.code!">
        </label><br>
        <input type="submit">
    </form>
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    New to the CF scene
    Join Date
    Oct 2019
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess I wasn't clear enough in my original post: I have no control over the labels and HTML when it comes to the coding fields, check boxes, ect. That is not my code; Lotus spews it out and I have to work with it, otheriwse, when I users clicks submit, we won't get any information.

    Your HTML would work if I didn't have to use this crappy CMS.

  4. #4
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,746
    Thanks
    5
    Thanked 537 Times in 523 Posts
    Quote Originally Posted by liquorun View Post
    Hi all!

    I have run into an issue due to how the anicent CMS, *Lotus Notes*, creates forms (you can't use traditional HTML to code your fields, radio buttons, check boxes etc). This is for work, so I cannot use different software unfortunately.
    Then really you're up manure river lacking a means of propulsion. Given the security holes ALONE in such outdated software, much less the result pissing on usability and accessibility from so on high you'd think the almighty just got back from a kegger?

    All I can hope is that this isn't web-facing or involving sensitive information about people... like a birthday.


    Quote Originally Posted by liquorun View Post
    Any suggestions?
    Call the county prosecutor for neglectful security practices?

    Seriously, given the trash we're seeing for markup mated to a question that is placing checks client-side that have zero business client-side, this entire mess belongs in the trash... why?

    Well, does the company you work for want to end up like this?

    https://www.cnbc.com/2019/10/07/domi...eme-court.html

    Because this is how you end up like that.

    Sorry if that seems harsh, but the light of reality often is. There is an increasing move towards no longer putting up with this type of fly-by-night "but it works fine for us" attitude, and more and more companies with such broken, outmoded, and insecure practices are having a reckoning called down upon them.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com

  5. #5
    New to the CF scene
    Join Date
    Oct 2019
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's quite the speech!

    No, this isn't sensitive information. I just used placeholders, and DOB and serial number was just the first thing that came to mind. I think I'm going to just tell them its not possible with this CMS, and to wait until we upgrade to a new platform hopefully next year.

  6. #6
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,746
    Thanks
    5
    Thanked 537 Times in 523 Posts
    Well, there is a way around it. There should be NO reason that their "form maker" is ACTUALLY required. View source on what it outputs, then clone that markup hardcoded in the template without their bracketed BS.

    Though the one or the other before sending? That's not something HTML is even designed to do, it would require JavaScript, and even then you would/should be re-checking that server-side

    The possible lack of a server-side check is why I think it's probably not viable without altering the CMS in question.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •