Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Conor Newman 6 posts 76 karma points
    Oct 31, 2023 @ 11:23
    Conor Newman
    0

    Registration form, including page title in submission

    I'm a complete beginner, so please bear with me, I'm sure this a very simple thing, but I'm confused.

    I have a working registration form I'm trying to edit, when its submitted I need the submitted data to include the page title which is in a hidden field called title (There are multiple registration forms, using the same template)

    I want to use the data in the below (titleInterval)

    var titleInterval = interval.GetValue("title");
    

    In the data submission to a registration tracking system, the tracking system, will use this to isolate which list to include this entry on.

    This is whats in the form already;

    <input type="text" name="testname1" data-bind="value: AcceptPermissonText">
    <input type="text" name="testname2" data-bind="value: AcceptTandCText">
    <input type="submit" value="Sumbit" />
    

    Before the submit line I want to add the data for the titleInterval variable above. Is it as simple as adding;

    <input type="hidden" name="testname3" data-bind="value: titleInterval">
    
  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Oct 31, 2023 @ 12:07
    Chriztian Steinmeier
    0

    Hi Conor,

    Is this in a regular Razor Template or Partial View?

    Then you should be able to do this:

    <input type="hidden" name="testname3" data-bind="value: @(titleInterval)">
    

    /Chriztian

  • Conor Newman 6 posts 76 karma points
    Oct 31, 2023 @ 12:18
    Conor Newman
    0

    Update: sorry: Its partial view.

    Thank you. I appreciate the help.

  • Conor Newman 6 posts 76 karma points
    Oct 31, 2023 @ 13:20
    Conor Newman
    0

    ok, so I'm getting an error, that "The name titleInterval does not exist in this context"

    So the line:

    var titleInterval = interval.GetValue("title");
    

    Is on the template (called "register") where as the line

    <input type="hidden" name="testname3" data-bind="value: @(titleInterval)">
    

    is on the actual partial views .cshtml page in question, which uses the "register" template, would this cause an error like this? If so how do I go about correcting it?

Please Sign in or register to post replies

Write your reply to:

Draft